appium-espresso-driver icon indicating copy to clipboard operation
appium-espresso-driver copied to clipboard

Error in starting appium-desktop using appium espresso - ava.lang.NoSuchMethodError: No virtual method getTargetState()Landroidx/lifecycle/Lifecycle$State

Open it-shivani opened this issue 3 years ago • 10 comments

Hi,

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.

it-shivani avatar Aug 18 '21 20:08 it-shivani

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.

mykola-mokhnach avatar Aug 18 '21 20:08 mykola-mokhnach

This is the error I am getting when I tried with androidx.lifecycle:lifecycle-extensions version 2.3.0

] Install command stdout: Performing Streamed Install [ADB] Success [ADB] Running '<PATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell "[ -e '/data/local/tmp/espresso.apppackage' ] && echo __PASS__"' [Espresso] The previous target application package is unknown [Espresso] Forcing Espresso server rebuild because of changed application package [Espresso] Loading the build configuration from 'espressoBuildConfig' capability [Espresso] Building espresso server in '/var/folders/_9/3n7f_43n4nl3c03xxprtsjbr0000gn/T/espresso-server-emulator-5554' [Espresso] The build folder root could be customized by changing the 'tmpDir' capability [Espresso] Copying espresso server template from ('/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-espresso-driver/espresso-server' to '/var/folders/_9/3n7f_43n4nl3c03xxprtsjbr0000gn/T/espresso-server-emulator-5554') [Support] Traversed 50 directories and 269 files in 340ms [Espresso] Bulding espresso server [Espresso] Adding the following additionalAppDependencies to build.gradle.kts: implementation("com.google.android.material:material:1.0.0"),implementation("androidx.lifecycle:lifecycle-extensions:2.3.0") [Espresso] Beginning build with command './gradlew -PappiumTargetPackage=<FILENAME> app:assembleAndroidTest' in directory '/var/folders/_9/3n7f_43n4nl3c03xxprtsjbr0000gn/T/espresso-server-emulator-5554' [Espresso] Output from Gradle will not be logged. To change this, use 'showGradleLog' desired capability [Espresso] Unable to build Espresso server - Process ended with exitcode 1 (cmd: './gradlew -PappiumTargetPackage\=<FILENAME>:assembleAndroidTest') [Espresso] Gradle error message: [Espresso] [Espresso] [STDERR] - https://repo.maven.apache.org/maven2/androidx/lifecycle/lifecycle-extensions/2.3.0/lifecycle-extensions-2.3.0.pom, [Espresso] [STDERR] Required by:, [Espresso] [STDERR] project :app, [Espresso] [STDERR] , [Espresso] [STDERR] * Try:, [Espresso] [STDERR] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights., [Espresso] [STDERR] , [Espresso] [STDERR] * Get more help at https://help.gradle.org, [Espresso] [STDOUT] , [Espresso] [STDOUT] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0., [Espresso] [STDOUT] Use '--warning-mode all' to show the individual deprecation warnings., [Espresso] [STDOUT] See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings, [Espresso] [STDERR] , [Espresso] [STDERR] BUILD FAILED in 17s, [Espresso] [STDOUT] 2 actionable tasks: 1 executed, 1 from cache [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 1629320946096 (14:09:06 GMT-0700 (Pacific Daylight Time)) [MJSONWP] Encountered internal error running command: A new session could not be created. Details: Unable to build Espresso server - Process ended with exitcode 1 (cmd: './gradlew -PappiumTargetPackage\=<FILENAME> app\:assembleAndroidTest') [MJSONWP] Gradle error message: [MJSONWP] [MJSONWP] [STDERR] - https://repo.maven.apache.org/maven2/androidx/lifecycle/lifecycle-extensions/2.3.0/lifecycle-extensions-2.3.0.pom, [MJSONWP] [STDERR] Required by:, [MJSONWP] [STDERR] project :app, [MJSONWP] [STDERR] , [MJSONWP] [STDERR] * Try:, [MJSONWP] [STDERR] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights., [MJSONWP] [STDERR] , [MJSONWP] [STDERR] * Get more help at https://help.gradle.org, [MJSONWP] [STDOUT] , [MJSONWP] [STDOUT] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0., [MJSONWP] [STDOUT] Use '--warning-mode all' to show the individual deprecation warnings., [MJSONWP] [STDOUT] See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings, [MJSONWP] [STDERR] , [MJSONWP] [STDERR] BUILD FAILED in 17s, [MJSONWP] [STDOUT] 2 actionable tasks: 1 executed, 1 from cache. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting. [MJSONWP] Error: Unable to build Espresso server - Process ended with exitcode 1 (cmd: './gradlew -PappiumTargetPackage\=<FILENAME> app\:assembleAndroidTest') [MJSONWP] Gradle error message: [MJSONWP] [MJSONWP] [STDERR] - https://repo.maven.apache.org/maven2/androidx/lifecycle/lifecycle-extensions/2.3.0/lifecycle-extensions-2.3.0.pom, [MJSONWP] [STDERR] Required by:, [MJSONWP] [STDERR] project :app, [MJSONWP] [STDERR] , [MJSONWP] [STDERR] * Try:, [MJSONWP] [STDERR] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights., [MJSONWP] [STDERR] , [MJSONWP] [STDERR] * Get more help at https://help.gradle.org, [MJSONWP] [STDOUT] , [MJSONWP] [STDOUT] Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0., [MJSONWP] [STDOUT] Use '--warning-mode all' to show the individual deprecation warnings., [MJSONWP] [STDOUT] See https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings, [MJSONWP] [STDERR] , [MJSONWP] [STDERR] BUILD FAILED in 17s, [MJSONWP] [STDOUT] 2 actionable tasks: 1 executed, 1 from cache. 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 ServerBuilder.runBuildProcess (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-espresso-driver/lib/server-builder.js:188:11) [HTTP] <-- POST /wd/hub/session 500 43554 ms - 1288 [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]

My understanding was we do not need to change anything in build.gradle if we use espressoBuildConfig dependency.

it-shivani avatar Aug 18 '21 21:08 it-shivani

What about 2.2.0? I saw 2.2.0 succeeded recently.

KazuCocoa avatar Aug 19 '21 01:08 KazuCocoa

Getting this error with 2.2.0 - java.lang.NoSuchMethodError: No direct method (ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V in class Lkotlin/jvm/internal/FunctionReferenceImpl; or its super classes (declaration of 'kotlin.jvm.internal.FunctionReferenceImpl'

Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://localhost:8300/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"allowTestPackages":true,"app":"<PATH>/AndApp/<FILEPATH>","automationName":"Espresso","deviceName":"Pixel2_API28","ensureWebviewsHavePages":true,"espressoBuildConfig":"{ \"additionalAppDependencies\": [ \"com.google.android.material:material:1.0.0\", \"androidx.lifecycle:lifecycle-extensions:2.2.0\" ] }","noReset":true,"platformName":"Android","platformVersion":"9","newCommandTimeout":0,"connectHardwareKeyboard":true},"allowTestPackages":true,"app":"<FILEPATH>","automationName":"Espresso","deviceName":"emulator-5554","ensureWebviewsHavePages":true,"espressoBuildConfig":"{ \"additionalAppDependencies\"...
[Espresso] [Instrumentation] Process crashed while executing startEspressoServer(io.appium.espressoserver.EspressoServerRunnerTest):
[Espresso] java.lang.NoSuchMethodError: No direct method (ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V in class Lkotlin/jvm/internal/FunctionReferenceImpl; or its super classes (declaration of 'kotlin.jvm.internal.FunctionReferenceImpl' appears in /data/app/io.appium.espressoserver.test-2XIAslE7wrgZfnwlSJ_GTA==/base.apk)
[Espresso] 	at <FILEPATH>SystemAlertsPresenter$systemAlertsBroadcastReceiver$1.(Unknown Source:10)
[Espresso] 	at <FILEPATH>.kt:21)
[Espresso] 	at <FILEPATH>kt:133)
[Espresso] 	at android.app.Activity.performCreate(Activity.java:7136)
[Espresso] 	at android.app.Activity.performCreate(Activity.java:7127)
[Espresso] 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
[Espresso] 	at androidx.test.runner.MonitoringInstrumentation.callActivityOnCreate(MonitoringInstrumentation.java:711)
[Espresso] 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
[Espresso] 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
[Espresso] 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
[Espresso] 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
[Espresso] 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
[Espresso] 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[Espresso] 	at android.os.Handler.dispatchMessage(Handler.java:106)
[Espresso] 	at android.os.Looper.loop(Looper.java:193)
[Espresso] 	at android.app.ActivityThread.main(ActivityThread.java:6669)
[Espresso] 	at java.lang.reflect.Method.invoke(Native Method)
[Espresso] 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[Espresso] 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[WD Proxy] socket hang up
[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'
[Espresso] [Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed.
[Espresso] INSTRUMENTATION_CODE: 0
[ADB] Running '<FILEPATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 shell am force-stop <FILEPATH>'
[Espresso] Instrumentation process exited with code 0 from signal null
[Logcat] Stopping logcat capture
[Espresso] Restoring hidden api policy to the device default configuration
[ADB] Running '<FILEPATH>/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 '<FILEPATH>/Library/Android/sdk/platform-tools/adb -P 5037 -s emulator-5554 forward --remove tcp:8300'
[BaseDriver] Event 'newSessionStarted' logged at 1629394922584 (10:42:02 GMT-0700 (Pacific Daylight Time))
[MJSONWP] Encountered internal error running command: A new session could not be created. Details: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
[MJSONWP] UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up. Check https://github.com/appium/appium-espresso-driver#troubleshooting regarding advanced session startup troubleshooting.
[MJSONWP]     at EspressoProxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:274:13)
[MJSONWP]     at processTicksAndRejections (internal/process/task_queues.js:85:5)
[HTTP] <-- POST /wd/hub/session 500 106253 ms - 382
[HTTP] 
[HTTP] --> DELETE /wd/hub/session
[HTTP] {}
[HTTP] No route found for /wd/hub/session
[HTTP] <-- DELETE /wd/hub/session 404 9 ms - 211

it-shivani avatar Aug 19 '21 18:08 it-shivani

What about adjusting Kotlin version with the app under test? You could check proguard stuff as well if your app under test used proguard. https://github.com/appium/appium-espresso-driver#troubleshooting

KazuCocoa avatar Aug 19 '21 22:08 KazuCocoa

What about adjusting Kotlin version with the app under test? You could check proguard stuff as well if your app under test used proguard. https://github.com/appium/appium-espresso-driver#troubleshooting

So Should I override kotlin version in the desired capabilities. What Kotlin version number should I use?

it-shivani avatar Aug 30 '21 21:08 it-shivani

It depends on your test app. If your app used the latest version, probably it is safe to use the same version in this driver. It may reduce build issues.

[Espresso] java.lang.NoSuchMethodError: No direct method (ILjava/lang/Object;Ljava/lang/Class;Ljava/lang/String;Ljava/lang/String;I)V in class Lkotlin/jvm/internal/FunctionReferenceImpl; or its super classes (declaration of 'kotlin.jvm.internal.FunctionReferenceImpl' appears in /data/app/io.appium.espressoserver.test-2XIAslE7wrgZfnwlSJ_GTA==/base.apk)

Sometimes the above error is caused by proguard when it optimizes code.

KazuCocoa avatar Aug 31 '21 02:08 KazuCocoa

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?

Andrey-Kinsa avatar Jul 01 '22 18:07 Andrey-Kinsa

@Andrey-Kinsa did you manage to solve this? I'm getting the same error

qb-nikola-popovic avatar Nov 14 '22 12:11 qb-nikola-popovic

@Andrey-Kinsa did you manage to solve this? I'm getting the same error

yes, but my fix is rather hacky. I had to go into appium install dir, and fix "espresso server" template project so it actually can be built in my dev environment.

Andrey-Kinsa avatar Nov 14 '22 18:11 Andrey-Kinsa