Error in starting appium-desktop using appium espresso - ava.lang.NoSuchMethodError: No virtual method getTargetState()Landroidx/lifecycle/Lifecycle$State
See original GitHub issueHi,
I am trying to launch appium-desktop with following config:
{ “automationName”: “Espresso”, “platformName”: “Android”, “platformVersion”: “9”, “deviceName”: “Pixel2_API28”, “app”: path/to/file.apk, “noReset”: true, “allowTestPackages”: true, “espressoBuildConfig”: “{ “additionalAppDependencies”: [ “com.google.android.material:material:1.0.0”, “androidx.lifecycle:lifecycle-extensions:2.1.0” ] }” }
My app is installed but then it is not launched on appium desktop
This is the error I see in appium server log
ADB] Install command stdout: Performing Streamed Install [ADB] Success [Espresso] Installed Espresso Test Server apk '/var/folders/_9/3n7f_43n4nl3c03xxprtsjbr0000gn/T/io.appium.espressoserver.test_1.44.0_<FILENAME>_emulator-5554.apk' (pkg: 'io.appium.espressoserver.test') [ADB] Adding packages ["io.appium.settings","io.appium.espressoserver.test"] to Doze whitelist [ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.espressoserver.test",";"]] [ADB] Running '<PATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.espressoserver.test ;' [Espresso] Performing cleanup of automation leftovers [Espresso] No obsolete sessions have been detected (socket hang up) [Espresso] Starting Espresso Server v1.44.0 with cmd: adb shell am instrument -w -e debug false -e disableAnalytics true io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner [ADB] Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","-e","debug",false,"-e","disableAnalytics",true,"io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner"] [Espresso] Waiting up to 45000ms for Espresso server to be online [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [WD Proxy] Matched '/status' to command name 'getStatus' [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [Espresso] [Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed. [Espresso] INSTRUMENTATION_CODE: 0 [Espresso] Instrumentation process exited with code 0 from signal null [Espresso] Espresso server process has been unexpectedly terminated. Check the Appium server log and the logcat output for more details [Espresso] Deleting espresso session [ADB] Running '<PATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am broadcast -a io.appium.settings.animation -n io.appium.settings/.receivers.AnimationSettingReceiver --es setstatus enable' [ADB] Running '<PATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop <FILENAME>' [Logcat] Stopping logcat capture [Espresso] Restoring hidden api policy to the device default configuration [ADB] Running '<PATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy'' [ADB] Removing forwarded port socket connection: 8300 [ADB] Running '<PATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8300' [BaseDriver] Event 'newSessionStarted' logged at 1629315782432 (12:43:02 GMT-0700 (Pacific Daylight Time)) [MJSONWP] Encountered internal error running command: A new session could not be created. Details: Espresso server process has been unexpectedly terminated. Check the Appium server log and the logcat output for more details. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting. [MJSONWP] Error: Espresso server process has been unexpectedly terminated. Check the Appium server log and the logcat output for more details. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting. [MJSONWP] at Object.errorAndThrow (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-support/lib/logging.js:94:35) [MJSONWP] at condFn (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-espresso-driver/lib/espresso-runner.js:283:18) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:138:26) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:20) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at spin (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:147:14) [MJSONWP] at waitForCondition (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/asyncbox/lib/asyncbox.js:154:10) [MJSONWP] at EspressoRunner.startSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-espresso-driver/lib/espresso-runner.js:277:7) [MJSONWP] at EspressoDriver.startEspressoSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-espresso-driver/lib/driver.js:318:5) [MJSONWP] at EspressoDriver.createSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-espresso-driver/lib/driver.js:188:7) [MJSONWP] at AppiumDriver.createSession (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/lib/appium.js:387:35) [HTTP] <-- POST /wd/hub/session 500 36185 ms - 346 [HTTP] [HTTP] --> DELETE /wd/hub/session [HTTP] {} [HTTP] No route found for /wd/hub/session [HTTP] <-- DELETE /wd/hub/session 404 1 ms - 211 [HTTP]
And here is my logcat logs
2021-08-18 12:43:39.944 7807-7807/<FILENAME> W/ActivityThread: Package uses different ABI(s) than its instrumentation: package[<FILENAME>]: x86, null instrumentation[io.appium.espressoserver.test]: null, null 2021-08-18 12:43:39.952 7807-7807/<FILENAME>: The ClassLoaderContext is a special shared library. at ion.a(SourceFile:2) 2021-08-18 12:43:39.846 7807-7807/?<FILENAME>: Not late-enabling -Xcheck:jni (already on) at com.google.android.ims.rcsmigration.IRcsStateProvider$Stub.dispatchTransaction(SourceFile:14) 2021-08-18 12:43:39.863 7807-7807/? <FILENAME>: Unexpected CPU variant for X86 using defaults: x86 2021-08-18 12:43:39.846 7807-7807/? <FILENAME>: Not late-enabling -Xcheck:jni (already on) 2021-08-18 12:43:39.863 7807-7807/? <FILENAME>: Unexpected CPU variant for X86 using defaults: x86 2021-08-18 12:43:39.846 7807-7807/?<FILENAME>: Not late-enabling -Xcheck:jni (already on) 2021-08-18 12:43:39.863 7807-7807/? <FILENAME>: Unexpected CPU variant for X86 using defaults: x86 2021-08-18 12:43:39.960 7807-7807/<FILENAME> I/chatty: uid=10107(<FILENAME>) identical 1 line 2021-08-18 12:43:39.966 7807-7807/<FILENAME>: The ClassLoaderContext is a special shared library. 2021-08-18 12:43:42.074 7807-7807/<FILENAME>: The ClassLoaderContext is a special shared library. 2021-08-18 12:43:42.075 7807-7807/<FILENAME>: The ClassLoaderContext is a special shared library. 2021-08-18 12:43:44.196 7807-7807/<FILENAME>: Accessing hidden method Landroid/app/Instrumentation;->execStartActivity(Landroid/content/Context;Landroid/os/IBinder;Landroid/os/IBinder;Landroid/app/Activity;Landroid/content/Intent;ILandroid/os/Bundle;)Landroid/app/Instrumentation$ActivityResult; (light greylist, linking) 2021-08-18 12:43:44.197 7807-7807/<FILENAME>: Accessing hidden method Landroid/app/Instrumentation;->execStartActivity(Landroid/content/Context;Landroid/os/IBinder;Landroid/os/IBinder;Ljava/lang/String;Landroid/content/Intent;ILandroid/os/Bundle;)Landroid/app/Instrumentation$ActivityResult; (light greylist, linking) 2021-08-18 12:43:44.303 7807-7834/<FILENAME>: Unknown chunk type '200'. 2021-08-18 12:43:44.331 7807-7807/<FILENAME> D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization. 2021-08-18 12:43:44.332 7807-7807/<FILENAME>D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization. 2021-08-18 12:43:44.333 7807-7807/<FILENAME>D/FirebaseApp: com.google.android.gms.measurement.AppMeasurement is not linked. Skipping initialization. 2021-08-18 12:43:44.333 7807-7807/<FILENAME> I/FirebaseInitProvider: FirebaseApp initialization successful 2021-08-18 12:43:44.370 7807-7807/<FILENAME> D/AndroidRuntime: Shutting down VM 2021-08-18 12:43:44.376 7807-7807/<FILENAME> E/AndroidRuntime: FATAL EXCEPTION: main Process:<FILENAME>, PID: 7807 java.lang.NoSuchMethodError: No virtual method getTargetState()Landroidx/lifecycle/Lifecycle$State; in class Landroidx/lifecycle/Lifecycle$Event; or its super classes (declaration of 'androidx.lifecycle.Lifecycle$Event' appears in /data/app/io.appium.espressoserver.test-5QLRV09rKvF7i7HFw_NWqg==/base.apk) at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134) at androidx.lifecycle.ProcessLifecycleOwner.attach(ProcessLifecycleOwner.java:159) at androidx.lifecycle.ProcessLifecycleOwner.init(ProcessLifecycleOwner.java:105) at androidx.lifecycle.ProcessLifecycleOwnerInitializer.onCreate(ProcessLifecycleOwnerInitializer.java:38) at android.content.ContentProvider.attachInfo(ContentProvider.java:1919) at android.content.ContentProvider.attachInfo(ContentProvider.java:1894) at android.app.ActivityThread.installProvider(ActivityThread.java:6391) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853) at android.app.ActivityThread.access$1100(ActivityThread.java:199) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 2021-08-18 12:43:44.382 7807-7807/<FILENAME> I/Process: Sending signal. PID: 7807 SIG: 9
Please help.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
I’m getting a similar issue with the next error in a logcat:
java.lang.RuntimeException: Unable to get provider androidx.startup.InitializationProvider: androidx.startup.StartupException: androidx.startup.StartupException: java.lang.NoSuchMethodError: No virtual method getTargetState()Landroidx/lifecycle/Lifecycle$State; in class Landroidx/lifecycle/Lifecycle$Event; or its super classes (declaration of 'androidx.lifecycle.Lifecycle$Event' appears in /data/app/~~83xiNtFI2K7XTqDJPvq1iA==/io.appium.espressoserver.test-7dz3NCaPxZevNFbsxHHXgA==/base.apk)
my espresso build config is:
"espressoBuildConfig": "{ \"additionalAppDependencies\": [ \"androidx.lifecycle:lifecycle-extensions:2.2.0\" ] }"
Does anybody have solution?
I would try to set a different version number for the
androidx.lifecycle:lifecycle-extensions
. Not sure in which version of it Google has added this particular enum.