appium-uiautomator2-server
appium-uiautomator2-server copied to clipboard
Instrumentation Error
My team uses the UiAutotmator2 Server (this component) independently of Appium. We get the apk and the test runner apk and start the server with an adb command and then send queries directly to it using the JSON Wire Protocol. Recently we decided to investigate moving from the 0.4.1 version we've been on since we started to the latest apks. To get the apks, I installed the latest version of Appium (1.10) and took them out of the node-modules folder. I discovered that the instrumentation had changed from what is listed in the ReadMe for this site:
io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner
to
io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
So it appears that the documentation for this component needs to be updated.
However, the bigger issue is that when I try to start the server using the instrumentation, I get a PermissionDenial error as follows:
java.lang.SecurityException: Permission Denial: starting instrumentation ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner} from pid=4100, uid=4100 not allowed because package io.appium.uiautomator2.server.test does not have a signature matching the target io.appium.uiautomator2.server
at android.os.Parcel.readException(Parcel.java:1684)
at android.os.Parcel.readException(Parcel.java:1637)
at android.app.ActivityManagerProxy.startInstrumentation(ActivityManagerNative.java:4546)
at com.android.commands.am.Am.runInstrument(Am.java:889)
at com.android.commands.am.Am.onRun(Am.java:400)
at com.android.internal.os.BaseCommand.run(BaseCommand.java:51)
at com.android.commands.am.Am.main(Am.java:121)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
INSTRUMENTATION_STATUS: id=ActivityManagerService
INSTRUMENTATION_STATUS: Error=Permission Denial: starting instrumentation ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner} from pid=4100, uid=4100 not allowed because package io.appium.uiautomator2.server.test does not have a signature matching the target io.appium.uiautomator2.server
INSTRUMENTATION_STATUS_CODE: -1
Seems like a signing error. Did you try uninstalling any old version first? Otherwise, looks like you may need to run apksigner on the artifacts.
Hi @jlipps, I did uninstall old versions, I had read about this, so I was sure to do that. If the problem is solved by running apksigner, why would it work for the Appium?
I'll research it and try it anyhow.
there's code in appium that allows it to resign things.
and anyway if you just downloaded the uia2 apks, they'll have been signed with appium's cert, and your app certainly won't have been. you're probably better off running this project from source and using gradle to build apks with your own debug cert.
@jlipps that first line seems like the key. So Appium is re-signing the pair of them?
As for the second paragraph, I'm using the two apks together (the server, and the 'test' that starts the server). That's the pair right? So the fact that its appium's cert shouldn't matter. Or am I misunderstanding how this works?
It sounds like the take away is that the released apks for this appium component can't be used unless they are signed together. There doesn't seem to be any documentation that informs users of this. I know I'm an atypical user by using the component on its own, but I probably am not the only one. Our team is trying to limit our dependencies as much as we can.
By the way, thanks for the responses!