安装包appium-uiautomator2-server-debug-androidTest.apk签名失败

问题详情:

[Instrumentation] **java.lang.SecurityException: Permission Denial: starting
instrumentation**
ComponentInfo{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner}
from pid=10029, uid=10029 **not allowed because package
io.appium.uiautomator2.server.test does not have a signature matching the
target io.appium.uiautomator2.server**

[Instrumentation] at android.os.Parcel.createException(Parcel.java:1966)

[Instrumentation] at android.os.Parcel.readException(Parcel.java:1934)

[Instrumentation] INSTRUMENTATION_STATUS: Error= **Permission Denial: starting
instrumentation ComponentInfo**
{io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner}
from pid=10029, uid=10029 not allowed because package
io.appium.uiautomator2.server.test does not have a signature matching the
target io.appium.uiautomator2.server

[Instrumentation] at android.os.Parcel.readException(Parcel.java:1884)

android.app.IActivityManager$Stub$Proxy.startInstrumentation(IActivityManager.java:4365)

[Instrumentation] at
com.android.commands.am.Instrument.run(Instrument.java:484)

[Instrumentation] at com.android.commands.am.Am.runInstrument(Am.java:194)

[Instrumentation] at com.android.commands.am.Am.onRun(Am.java:80)

[Instrumentation] at
com.android.internal.os.BaseCommand.run(BaseCommand.java:54)

[Instrumentation] at com.android.commands.am.Am.main(Am.java:50)

[Instrumentation] at
com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)

[Instrumentation] at
com.android.internal.os.RuntimeInit.main(RuntimeInit.java:341)

[Instrumentation] Caused by: android.os.RemoteException: Remote stack trace:

com.android.server.am.ActivityManagerService.startInstrumentation(ActivityManagerService.java:26699)

android.app.IActivityManager$Stub.onTransact$startInstrumentation$(IActivityManager.java:11161)

[Instrumentation] at
android.app.IActivityManager$Stub.onTransact(IActivityManager.java:440)

com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:4140)

[Instrumentation] at android.os.Binder.execTransact(Binder.java:739)

[Instrumentation] **INSTRUMENTATION_STATUS: id=ActivityManagerService**

[Instrumentation] **INSTRUMENTATION_STATUS_CODE: -1**

[Instrumentation] The process has exited with code 1

[UiAutomator2] Error: The instrumentation process cannot be initialized.
**Make sure the application under test does not crash and investigate the
logcat output.**  
[UiAutomator2] at Object.wrappedLogger.errorAndThrow (C:\Program
Files\Appium\resources\app\node_modules\appium\node_modules\appium-
support\lib\logging.js:78:13)  
[UiAutomator2] at UiAutomator2Server.errorAndThrow [as startSession]
(C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\Appium

解决方案:

使用Android SDK中的 apksigner.bat 工具 对 Appium 的安装包 appium-uiautomator2-server-debug-androidTest.apk 进行手动签名。

第1步:进入安卓 SDK 目录,然后进入子目录\build-tools\29.0.3,按下 Shift 键,在空白处点击鼠标右键,在弹出的菜单那中选择,在此处打开 PowerShell 窗口,如下图所示:

第2步:在弹出窗口中输入: .\apksigner.bat verify --print-certs %localappdata%\Programs\Appium\resources\app\node_modules\appium\node_modules\appium- uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk

按回车确认,如果能出现图中的 3 个 Signer # 1 的输出,说明签名成功。

其他参考资料:

https://github.com/appium/appium/issues/14001

问题没有解决?去社区提问 all right reserved,powered by Gitbook

results matching ""

    No results matching ""