appium / appium-espresso-driver

Espresso integration for Appium
Apache License 2.0
193 stars 75 forks source link

Espresso server fails to start #746

Open KarimOnwd opened 2 years ago

KarimOnwd commented 2 years ago

The problem

I'm trying to switch from uiautomator2 to espresso and the server does not start Note : Everything works fine while using uiautomator2 (App starts, element is located and taped successfully)

Environment

Note : I set the apk path in the capabilities I attached the emulator logcat logcat_espresso.txt

Details

The following error is displayed after the server fails to be online:

Espresso] Installed Espresso Test Server apk 'C:\Users\USER1\AppData\Local\Temp\io.appium.espressoserver.test_1.45.3_com.remedeelabs.remedeehealth_emulator-5554.apk' (pkg: 'io.appium.espressoserver.test') [ADB] Adding packages ["io.appium.settings","io.appium.espressoserver.test"] to Doze whitelist [debug] [ADB] Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.espressoserver.test",";"]] [debug] [ADB] Running 'C:\Users\User1\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.espressoserver.test ;'[debug] [Espresso] Performing cleanup of automation leftovers [debug] [Espresso] No obsolete sessions have been detected (socket hang up) [Espresso] Starting Espresso Server v1.45.3 with cmd: adb shell am instrument -w -e debug false -e disableAnalytics true io.appium.espressoserver.test/androidx.test.runner.AndroidJUnitRunner [debug] [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 [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [debug] [Espresso] [Instrumentation] INSTRUMENTATION_RESULT: shortMsg=Process crashed. [debug] [Espresso] INSTRUMENTATION_CODE: 0 [debug] [WD Proxy] Matched '/status' to command name 'getStatus' [debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:8300/status] with no body [WD Proxy] socket hang up [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

KazuCocoa commented 2 years ago
2022-02-02 13:53:27.992 14592-14592/com.appAssistant.apphealth E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.appAssistant.apphealth, PID: 14592
    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/~~yb319UqzJa7CQTOaSiG9gQ==/io.appium.espressoserver.test-UnImoz6qB1dO8eNOA3fbcA==/base.apk)
        at androidx.lifecycle.LifecycleRegistry.handleLifecycleEvent(LifecycleRegistry.java:134)
        at androidx.lifecycle.ProcessLifecycleOwner.attach(ProcessLifecycleOwner.java:161)
        at androidx.lifecycle.ProcessLifecycleOwner.init(ProcessLifecycleOwner.java:106)
        at androidx.lifecycle.ProcessLifecycleOwnerInitializer.onCreate(ProcessLifecycleOwnerInitializer.java:38)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
        at android.app.ActivityThread.installProvider(ActivityThread.java:7239)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6780)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6697)
        at android.app.ActivityThread.access$1300(ActivityThread.java:237)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1913)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Probably your env needs Lifecycle as https://github.com/appium/appium-espresso-driver#espresso-build-config like https://github.com/appium/appium-espresso-driver/blob/006bcfcf5a4d07713cb3e6d7a032ce80704cf28d/test/functional/desired.js#L23

ChekistNSK commented 2 years ago

I got same problem but my Logcat is different:

2022-02-15 15:52:27.137 4460-4460/? I/appium.setting: Late-enabling -Xcheck:jni 2022-02-15 15:52:27.168 4460-4460/? E/appium.setting: Unknown bits set in runtime_flags: 0x8000 2022-02-15 15:52:27.632 4460-4460/io.appium.settings I/FeatureParser: can't find galahad.xml in assets/device_features/,it may be in /vendor/etc/device_features 2022-02-15 15:52:27.736 4460-4460/io.appium.settings W/IconCustomizer: can't load transform_config.xml 2022-02-15 15:52:27.751 4460-4460/io.appium.settings D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.appium.settings activity: io.appium.settings.Settings@a765584 2022-02-15 15:52:27.752 4460-4460/io.appium.settings I/chatty: uid=10560(io.appium.settings) identical 1 line 2022-02-15 15:52:27.753 4460-4460/io.appium.settings D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.appium.settings activity: io.appium.settings.Settings@a765584 2022-02-15 15:52:27.757 4460-4460/io.appium.settings D/ForceDarkHelper: updateByCheckExcludeList: pkg: io.appium.settings activity: io.appium.settings.Settings@a765584 2022-02-15 15:52:27.761 4460-4460/io.appium.settings D/APPIUM SETTINGS: Entering the app 2022-02-15 15:52:27.779 4460-4460/io.appium.settings D/LocationTracker: Configuring location provider for Google Play Services 2022-02-15 15:52:27.832 4460-4460/io.appium.settings D/APPIUM SERVICE: Initializing the foreground service 2022-02-15 15:52:27.837 4460-4460/io.appium.settings D/APPIUM SETTINGS: Closing the app 2022-02-15 15:52:27.853 4460-4460/io.appium.settings I/SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@c6fceaa 2022-02-15 15:52:27.881 4460-4460/io.appium.settings I/PowerHalWrapper: PowerHalWrapper.getInstance 2022-02-15 15:52:27.897 4460-4460/io.appium.settings W/Looper: Slow Looper main: Activity io.appium.settings/.Settings is 479ms late (wall=1ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] }) because of 2 msg, msg 1 took 235ms (seq=2 running=191ms runnable=13ms io=15ms late=1ms h=android.app.ActivityThread$H w=110), msg 2 took 245ms (seq=3 running=154ms runnable=10ms io=32ms late=236ms h=android.app.ActivityThread$H w=159) 2022-02-15 15:52:27.924 4460-4460/io.appium.settings W/Notification: Use of stream types is deprecated for operations other than volume control 2022-02-15 15:52:27.924 4460-4460/io.appium.settings W/Notification: See the documentation of setSound() for what to use instead with android.media.AudioAttributes to qualify your playback use case 2022-02-15 15:52:27.966 4460-4568/io.appium.settings I/GPUD: @gpudInitialize: successfully initialized with GL, dbg=0 mmdump_dbg=0 2022-02-15 15:52:28.018 4460-4568/io.appium.settings D/Surface: Surface::connect(this=0x7a3610f000,api=1) 2022-02-15 15:52:28.019 4460-4568/io.appium.settings D/mali_winsys: EGLint new_window_surface(egl_winsys_display , void , EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000 2022-02-15 15:52:28.019 4460-4568/io.appium.settings D/Surface: Surface::setBufferCount(this=0x7a3610f000,bufferCount=3) 2022-02-15 15:52:28.021 4460-4568/io.appium.settings D/Surface: Surface::allocateBuffers(this=0x7a3610f000) 2022-02-15 15:52:28.032 4460-4568/io.appium.settings W/Gralloc3: mapper 3.x is not supported 2022-02-15 15:52:28.040 4460-4568/io.appium.settings E/gralloc: Arm Module v1.0 2022-02-15 15:52:28.049 4460-4568/io.appium.settings E/ion: ioctl c0044901 failed with code -1: Invalid argument 2022-02-15 15:52:28.360 4460-4460/io.appium.settings D/LocationTracker: Google Play Services location provider is connected 2022-02-15 15:52:28.441 4460-4460/io.appium.settings D/LocationTracker: Got an updated location 2022-02-15 15:52:29.029 4460-4568/io.appium.settings D/Surface: Surface::disconnect(this=0x7a3610f000,api=1) 2022-02-15 15:52:29.070 4460-4460/io.appium.settings D/View: [Warning] assignParent to null: this = DecorView@55fc08b[Settings] 2022-02-15 15:52:35.610 4460-4555/io.appium.settings I/appium.setting: ProcessProfilingInfo new_methods=498 is saved saved_to_disk=1 resolve_classes_delay=8000

And this

java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mypath. Make sure to call FirebaseApp.initializeApp(Context) first.