要过GMS认证,遇到个问题。
安装CtsVerifier.apk。前面几个选项都OK。
可以测试成功。
执行
Camera ITS Test 的时候崩溃。
查看log:
r: Accessing hidden method Landroid/hardware/devicestate/DeviceStateManager;->getSupportedStates()[I (blocked,test-api, linking, denied)
07-27 08:12:50.546 31687 31687 W id.cts.verifier: If this is a platform test consider enabling VMRuntime.ALLOW_TEST_API_ACCESS change id for this package.
07-27 08:12:50.546 31687 31687 D AndroidRuntime: Shutting down VM
--------- beginning of crash
07-27 08:12:50.548 31687 31687 E AndroidRuntime: FATAL EXCEPTION: main
07-27 08:12:50.548 31687 31687 E AndroidRuntime: Process: com.android.cts.verifier, PID: 31687
07-27 08:12:50.548 31687 31687 E AndroidRuntime: java.lang.NoSuchMethodError: No virtual method getSupportedStates()[I in class Landroid/hardware/devicestate/DeviceStateManager; or its super classes (declaration of 'android.hardware.devicestate.DeviceStateManager' appears in /system/framework/framework.jar)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.hardware.cts.helpers.CameraUtils.isDeviceFoldable(CameraUtils.java:298)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at com.android.cts.verifier.camera.its.ItsTestActivity.isFoldableDevice(ItsTestActivity.java:625)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at com.android.cts.verifier.camera.its.ItsTestActivity.onCreate(ItsTestActivity.java:505)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8290)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:8269)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1385)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3658)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3814)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2309)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:201)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.os.Looper.loop(Looper.java:288)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7944)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
07-27 08:12:50.548 31687 31687 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:942)
07-27 08:12:50.555 1467 3990 W ActivityTaskManager: Force finishing activity com.android.cts.verifier/.camera.its.ItsTestActivity
07-27 08:12:50.555 1467 31757 I DropBoxManagerService: add tag=system_app_crash isTagEnabled=true flags=0x2
07-27 08:12:50.558 853 987 I qdmetadata: setGralloc4Array befores witch paramType = 16 isSet = 1
07-27 08:12:50.560 610 8084 D TmsTml : THN31 - Read requested.....
没有找到方法:
AndroidRuntime: java.lang.NoSuchMethodError: No virtual method getSupportedStates()
将Apk编译到ROM里。运行也没有成功。
运行出现以下崩溃信息:
Accessing hidden method Landroid/hardware/devicestate/DeviceStateManager;->getSupportedStates()[I (blocked,test-api, linking, denied)
再看有Log提示:
id.cts.verifier: If this is a platform test consider enabling VMRuntime.ALLOW_TEST_API_ACCESS change id for this package.
需要赋予ALLOW_TEST_API_ACCESS的权限。
执行命令:
adb -s <device_id> shell am compat enable ALLOW_TEST_API_ACCESS com.android.cts.verifier
执行adb 命令:
adb devices 查看设备名字。
发现设备名字是T90
再执行:
adb -s T90 shell am compat enable ALLOW_TEST_API_ACCESS com.android.cts.verifier
即可。