Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests on Android gets stuck in the "before all" hook #395

Closed
ilonashub opened this issue Nov 9, 2017 · 31 comments
Closed

Running tests on Android gets stuck in the "before all" hook #395

ilonashub opened this issue Nov 9, 2017 · 31 comments

Comments

@ilonashub
Copy link

Description

hey, I am having an issue with running detox on Android. We got it working in iOS and now wanted to add Android tests as well.
We use RN 0.49.
When I run detox on Android - I get a white screen, and in the console I get stuck in the "before all" hook:

 1) "before all" hook

  0 passing (3m)
  1 failing

  1) "before all" hook:
     Error: Timeout of 200000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

Steps to Reproduce

After following all the steps in the Android guide (and fixing some versions issues, and fixes from the troubleshooting), I tried to run the text:
detox test --configuration android.emu.debug -l verbose , and got the following logs:

Start
detox-server info 15:56:55: server listening on localhost:64180...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"5e43bcb5-acd5-0c85-6791-bce08925d109","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"5e43bcb5-acd5-0c85-6791-bce08925d109","role":"tester"},"messageId":0}
detox verb ws
detox verb 1: /Users/ilonashub/Library/Android/sdk/tools/emulator -list-avds --verbose
detox verb 1: stdout: Nexus_5X_API_23
detox verb 1: stdout: Nexus_5X_API_24
detox verb 1: stdout:
detox verb Emulator stdout:  emulator: Android virtual device file at: /Users/ilonashub/.android/avd/Nexus_5X_API_24.ini
detox verb Emulator stdout:  emulator: virtual device content at /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd
detox verb Emulator stdout:  emulator: virtual device config file: /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/config.ini
detox verb Emulator stdout:  emulator: using core hw config path: /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/hardware-qemu.ini
detox verb Emulator stdout:  emulator: Found AVD target API level: 24
detox verb Emulator stdout:  emulator: Read property file at /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//build.prop
detox verb Emulator stdout:  emulator: No boot.prop property file found.
detox verb Emulator stdout:  emulator: found skin 'nexus_5x' in directory: /Users/ilonashub/Library/Android/sdk/skins/
detox verb Emulator stdout:  emulator: autoconfig: -skin nexus_5x
detox verb Emulator stdout:  emulator: autoconfig: -skindir /Users/ilonashub/Library/Android/sdk/skins/
detox verb Emulator stdout:  emulator: autoconfig: -kernel /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//kernel-ranchu
detox verb Emulator stdout:  emulator: Target arch = 'x86'
detox verb Emulator stdout:  emulator: Auto-config: -qemu -cpu qemu32
detox verb Emulator stdout:  emulator: Auto-detect: Kernel image requires new device naming scheme.
detox verb Emulator stdout:  emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
detox verb Emulator stdout:  emulator: autoconfig: -ramdisk /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//ramdisk.img
detox verb Emulator stdout:  emulator: Using initial system image: /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//system.img
detox verb Emulator stdout:  emulator: No vendor image
detox verb Emulator stdout:  emulator: autoconfig: -data /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/userdata-qemu.img
detox verb Emulator stdout:  emulator: autoconfig: -initdata /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/userdata.img
detox verb Emulator stdout:  emulator: autoconfig: -cache /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/cache.img
detox verb Emulator stdout:  emulator: autoconfig: -sdcard /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/sdcard.img
detox verb Emulator stdout:  emulator: Physical RAM size: 1536MB
detox verb Emulator stdout:
detox verb Emulator stdout:  emulator: VM heap size 256MB is below hardware specified minimum of 384MB,setting it to that value
detox verb Emulator stdout:  emulator: System image is read only
detox verb Emulator stdout:  emulator: Found 2 DNS servers: 192.115.106.35 62.219.186.7
detox verb Emulator stdout:  emulator: ERROR: There's another emulator instance running with the current AVD 'Nexus_5X_API_24'. Exiting...
detox verb Emulator stdout:
detox verb Emulator stdout:
detox verb 2: /Users/ilonashub/Library/Android/sdk/platform-tools/adb  devices
detox verb 2: stdout: List of devices attached
detox verb 2: stdout: emulator-5554	device
detox verb 2: stdout:
detox verb 2: stdout:
detox verb 3: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell input keyevent 82
detox verb 4: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.homeismobile
detox verb 4: stdout: Success
detox verb 4: stdout:
detox verb 5: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.homeismobile.test
detox verb 5: stdout: Success
detox verb 5: stdout:
detox verb 6: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/ilonashub/homeis/home-is-mobile/android/app/build/outputs/apk/app-debug.apk
detox verb 6: stderr: Success
detox verb 6: stderr:
detox verb 7: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/ilonashub/homeis/home-is-mobile/android/app/build/outputs/apk/app-debug-androidTest.apk
detox verb 7: stderr: Success
detox verb 7: stderr:
detox verb 8: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.homeismobile
detox verb adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:64180 -e detoxSessionId 5e43bcb5-acd5-0c85-6791-bce08925d109 -e debug false com.homeismobile.test/android.support.test.runner.AndroidJUnitRunner
detox verb Instrumentation spawned, childProcess.pid:  27598
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.homeismobile.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.homeismobile.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:
  1) "before all" hook

  0 passing (3m)
  1 failing

  1) "before all" hook:
     Error: Timeout of 200000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.




detox verb ws send: {"type":"cleanup","params":{"stopRunner":true},"messageId":1}

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 5.9.1
  • Node: 8.4.0
  • Device: nexus_5x_API_24
  • Xcode: 9.1
  • macOS: 10.12.6

Device and verbose Detox logs

from the adb logcat I could see a few errors - which I think are unrelated to the issue (for example pushwoosh error shouldn't prevent the app to be up I think. So I added some of the logs with warnings/errors here.

......
11-09 16:03:19.386  2145  2681 E Volley  : [147] BasicNetwork.performRequest: Unexpected response code 307 for https://android.googleapis.com/nova/herrevad/network_quality_info
11-09 16:03:19.391  2145  5906 W Herrevad: [481] RemoteReportsRefreshChimeraService.a: java.util.concurrent.ExecutionException: com.android.volley.ServerError
11-09 16:03:19.391  2145  5906 W Herrevad: java.util.concurrent.ExecutionException: com.android.volley.ServerError
11-09 16:03:19.391  2145  5906 W Herrevad: 	at com.android.volley.toolbox.RequestFuture.a(:com.google.android.gms@11743470:4)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at com.android.volley.toolbox.RequestFuture.get(:com.google.android.gms@11743470:2)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at com.google.android.gms.herrevad.services.RemoteReportsRefreshChimeraService.a(:com.google.android.gms@11743470:26)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at com.google.android.gms.herrevad.services.RemoteReportsRefreshChimeraService.a(:com.google.android.gms@11743470:33)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at sxf.run(:com.google.android.gms@11743470:1)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at java.lang.Thread.run(Thread.java:761)
11-09 16:03:19.391  2145  5906 W Herrevad: Caused by: com.android.volley.ServerError
11-09 16:03:19.391  2145  5906 W Herrevad: 	at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms@11743470:37)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at mhc.performRequest(:com.google.android.gms@11743470:4)
11-09 16:03:19.391  2145  5906 W Herrevad: 	at com.android.volley.NetworkDispatcher.run(:com.google.android.gms@11743470:12)
11-09 16:03:19.444  5829  5900 W System  : ClassLoader referenced unknown path: /system/app/Chrome/lib/x86
......
11-09 16:03:19.542  5829  5898 V WebViewChromiumFactoryProvider: Binding Chromium to main looper Looper (main, tid 1) {90d2951}
11-09 16:03:19.691  1944  2248 W Conscrypt: Could not set socket write timeout:
11-09 16:03:19.691  1944  2248 W Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
11-09 16:03:19.691  1944  2248 W Conscrypt:    com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11743470:13)
11-09 16:03:19.710  1944  1944 I WearableService: Wearable Services stopping
11-09 16:03:19.837  1944  2248 W Conscrypt: Could not set socket write timeout:
11-09 16:03:19.838  1944  2248 W Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
11-09 16:03:19.838  1944  2248 W Conscrypt:    com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11743470:13)
11-09 16:03:28.206  5829  5886 W unknown:InspectorPackagerConnection: Couldn't connect to packager, will silently retry
11-09 16:03:39.339  3495  3533 W Finsky  : [210] com.google.android.finsky.FinskyApp.i(1468): No account configured on this device.
11-09 16:03:39.341  3495  3533 I Finsky  : [210] com.google.android.finsky.c.e.run(1151): Replicating app states via AMAS.
11-09 16:03:39.397  3495  3533 I Finsky  : [210] com.google.android.finsky.c.c.a(311): Completed 0 account content syncs with 0 successful.
11-09 16:03:39.397  3495  3495 I Finsky  : [1] com.google.android.finsky.services.j.a(149): Installation state replication succeeded.
....
11-09 16:09:47.871  1944  2714 W Conscrypt: Could not set socket write timeout:
11-09 16:09:47.872  1944  2714 W Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
11-09 16:09:47.872  1944  2714 W Conscrypt:    com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11743470:13)
11-09 16:09:48.034  1944  2714 W Conscrypt: Could not set socket write timeout:
11-09 16:09:48.034  1944  2714 W Conscrypt:    java.lang.reflect.Method.invoke(Native Method)
11-09 16:09:48.036  1944  2714 W Conscrypt:    com.google.android.gms.org.conscrypt.Platform.setSocketWriteTimeout(:com.google.android.gms@11743470:13)
11-09 16:09:48.193  1944  2714 W GLSUser : [AppCertManager] IOException while requesting key:
11-09 16:09:48.193  1944  2714 W GLSUser : java.io.IOException: Invalid device key response.
11-09 16:09:48.193  1944  2714 W GLSUser : 	at eyw.a(:com.google.android.gms@11743470:14)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at eyw.a(:com.google.android.gms@11743470:65)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at eyu.a(:com.google.android.gms@11743470:8)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at eyq.a(:com.google.android.gms@11743470:1)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at eyp.a(:com.google.android.gms@11743470:10)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at com.google.android.gms.auth.account.be.legacy.AuthCronChimeraService.b(:com.google.android.gms@11743470:7)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at edr.call(:com.google.android.gms@11743470:3)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at mmu.run(:com.google.android.gms@11743470:26)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at mse.run(:com.google.android.gms@11743470)
11-09 16:09:48.193  1944  2714 W GLSUser : 	at java.lang.Thread.run(Thread.java:761)
@ilonashub
Copy link
Author

@simonracz can you please elaborate on your comment If your app is a hybrid app, then, is your detox android test (not the js, but the java test) starts the correct Activity, which starts RN?? I am not sure I understood what you meant
Thanks!! :)

@rotemmiz
Copy link
Member

Which of the PIDs in the device log is your app ? is it 2145 ?
@simonracz mentioned this is probably a hybrid app since there's a volley request that causes com.android.volley.ServerError. RN uses OkHTTP on Android, volley is not a part of its network stack.

@LeoNatan
Copy link
Contributor

#407 - Are these two bugs related? @rotemmiz If so, please close #407.

@ilonashub
Copy link
Author

ilonashub commented Nov 15, 2017

@rotemmiz thanks for the comment!

Following the tries - I tried to make it work with an android release apk:

"android.emu.release": {
        "binaryPath": "android/app/build/outputs/apk/app-release.apk",
        "build": "pushd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && popd",
        "type": "android.emulator",
        "name": "Nexus_5X_API_24"
      }

The logs from the running detox test --configuration android.emu.release --loglevel verbose:

detox-server info 14:37:01: server listening on localhost:51097...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"b52d2ca2-b6c0-fd46-5064-80276dbbcf91","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"b52d2ca2-b6c0-fd46-5064-80276dbbcf91","role":"tester"},"messageId":0}
detox verb ws
detox verb 1: /Users/ilonashub/Library/Android/sdk/tools/emulator -list-avds --verbose
detox verb 1: stdout: Nexus_5X_API_23
detox verb 1: stdout: Nexus_5X_API_24
detox verb 1: stdout:
detox verb Emulator stdout:  emulator: Android virtual device file at: /Users/ilonashub/.android/avd/Nexus_5X_API_24.ini
detox verb Emulator stdout:  emulator: virtual device content at /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd
detox verb Emulator stdout:  emulator: virtual device config file: /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/config.ini
detox verb Emulator stdout:  emulator: using core hw config path: /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/hardware-qemu.ini
detox verb Emulator stdout:  emulator: Found AVD target API level: 24
detox verb Emulator stdout:  emulator: Read property file at /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//build.prop
detox verb Emulator stdout:  emulator: No boot.prop property file found.
detox verb Emulator stdout:  emulator: found skin 'nexus_5x' in directory: /Users/ilonashub/Library/Android/sdk/skins/
detox verb Emulator stdout:  emulator: autoconfig: -skin nexus_5x
detox verb Emulator stdout:  emulator: autoconfig: -skindir /Users/ilonashub/Library/Android/sdk/skins/
detox verb Emulator stdout:  emulator: autoconfig: -kernel /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//kernel-ranchu
detox verb Emulator stdout:  emulator: Target arch = 'x86'
detox verb Emulator stdout:  emulator: Auto-config: -qemu -cpu qemu32
detox verb Emulator stdout:  emulator: Auto-detect: Kernel image requires new device naming scheme.
detox verb Emulator stdout:  emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
detox verb Emulator stdout:  emulator: autoconfig: -ramdisk /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//ramdisk.img
detox verb Emulator stdout:  emulator: Using initial system image: /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//system.img
detox verb Emulator stdout:  emulator: No vendor image
detox verb Emulator stdout:  emulator: autoconfig: -data /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/userdata-qemu.img
detox verb Emulator stdout:  emulator: autoconfig: -initdata /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/userdata.img
detox verb Emulator stdout:  emulator: autoconfig: -cache /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/cache.img
detox verb Emulator stdout:  emulator: autoconfig: -sdcard /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/sdcard.img
detox verb Emulator stdout:  emulator: Physical RAM size: 1536MB
detox verb Emulator stdout:
detox verb Emulator stdout:  emulator: VM heap size 256MB is below hardware specified minimum of 384MB,setting it to that value
detox verb Emulator stdout:  emulator: System image is read only
detox verb Emulator stdout:  emulator: Found 2 DNS servers: 192.115.106.35 62.219.186.7
detox verb Emulator stdout:  emulator: ERROR: There's another emulator instance running with the current AVD 'Nexus_5X_API_24'. Exiting...
detox verb Emulator stdout:
detox verb Emulator stdout:
detox verb 2: /Users/ilonashub/Library/Android/sdk/platform-tools/adb  devices
detox verb 2: stdout: List of devices attached
detox verb 2: stdout: emulator-5554	device
detox verb 2: stdout:
detox verb 2: stdout:
detox verb 3: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell input keyevent 82
detox verb 4: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.homeismobile
detox verb 4: stdout: Success
detox verb 4: stdout:
detox verb 5: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.homeismobile.test
detox verb 5: stdout: Failure [DELETE_FAILED_INTERNAL_ERROR]
detox verb 5: stdout:
detox verb 6: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/ilonashub/homeis/home-is-mobile/android/app/build/outputs/apk/app-release.apk
detox verb 6: stderr: Success
detox verb 6: stderr:
detox verb 7: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/ilonashub/homeis/home-is-mobile/android/app/build/outputs/apk/app-release-androidTest.apk
detox verb 7: stderr: Success
detox verb 7: stderr:
detox verb 8: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.homeismobile
detox verb adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:51097 -e detoxSessionId b52d2ca2-b6c0-fd46-5064-80276dbbcf91 -e debug false com.homeismobile.test/android.support.test.runner.AndroidJUnitRunner
detox verb Instrumentation spawned, childProcess.pid:  91265
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.homeismobile.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.homeismobile.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:

and in the adb logcat I still get some errors (some are from a 3rd party library we're using - pushwoosh - which might use hybrid):

11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: failed to remove uid from uid_cputime module
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: java.io.FileNotFoundException: /proc/uid_cputime/remove_uid_range (No such file or directory)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at java.io.FileOutputStream.open(Native Method)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at java.io.FileOutputStream.<init>(FileOutputStream.java:108)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at java.io.FileWriter.<init>(FileWriter.java:63)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.internal.os.KernelUidCpuTimeReader.removeUid(KernelUidCpuTimeReader.java:158)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.internal.os.BatteryStatsImpl.removeUidStatsLocked(BatteryStatsImpl.java:9805)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.server.am.BatteryStatsService.removeUid(BatteryStatsService.java:291)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.server.am.ActivityManagerService.broadcastIntentLocked(ActivityManagerService.java:17857)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:18346)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.server.pm.PackageManagerService$8.run(PackageManagerService.java:11407)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at android.os.Handler.handleCallback(Handler.java:751)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at android.os.Handler.dispatchMessage(Handler.java:95)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at android.os.Looper.loop(Looper.java:154)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at android.os.HandlerThread.run(HandlerThread.java:61)
11-15 14:37:02.896  1585  1610 E KernelUidCpuTimeReader: 	at com.android.server.ServiceThread.run(ServiceThread.java:46)
.....
11-15 14:37:07.067  4354  4354 I art     : Rejecting re-init on previously-failed class java.lang.Class<android.support.v4.app.JobIntentService$JobServiceEngineImpl>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/app/job/JobServiceEngine;
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.Class.classForName!(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:400)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.Class.forName(java.lang.String) (Class.java:326)
11-15 14:37:07.067  4354  4354 I art     :   at boolean com.pushwoosh.internal.a.c.a() ((null):-1)
11-15 14:37:07.067  4354  4354 I art     :   at boolean com.pushwoosh.internal.a.b.b() ((null):-1)
11-15 14:37:07.067  4354  4354 I art     :   at boolean com.pushwoosh.PushwooshInitProvider.onCreate() ((null):-1)
11-15 14:37:07.067  4354  4354 I art     :   at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1751)
11-15 14:37:07.067  4354  4354 I art     :   at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1726)
11-15 14:37:07.067  4354  4354 I art     :   at android.app.IActivityManager$ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.IActivityManager$ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:5811)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5403)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5342)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.-wrap2(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1528)
11-15 14:37:07.067  4354  4354 I art     :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-15 14:37:07.067  4354  4354 I art     :   at void android.os.Looper.loop() (Looper.java:154)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-15 14:37:07.067  4354  4354 I art     :   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
11-15 14:37:07.067  4354  4354 I art     :   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
11-15 14:37:07.067  4354  4354 I art     : Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.job.JobServiceEngine" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.homeismobile.test-1/base.apk", zip file "/data/app/com.homeismobile-1/base.apk"],nativeLibraryDirectories=[/data/app/com.homeismobile.test-1/lib/x86, /data/app/com.homeismobile-1/lib/x86, /system/fake-libs, /data/app/com.homeismobile.test-1/base.apk!/lib/x86, /data/app/com.homeismobile-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.Class.classForName!(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:-2)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (Class.java:400)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Class java.lang.Class.forName(java.lang.String) (Class.java:326)
11-15 14:37:07.067  4354  4354 I art     :   at boolean com.pushwoosh.internal.a.c.a() ((null):-1)
11-15 14:37:07.067  4354  4354 I art     :   at boolean com.pushwoosh.internal.a.b.b() ((null):-1)
11-15 14:37:07.067  4354  4354 I art     :   at boolean com.pushwoosh.PushwooshInitProvider.onCreate() ((null):-1)
11-15 14:37:07.067  4354  4354 I art     :   at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo, boolean) (ContentProvider.java:1751)
11-15 14:37:07.067  4354  4354 I art     :   at void android.content.ContentProvider.attachInfo(android.content.Context, android.content.pm.ProviderInfo) (ContentProvider.java:1726)
11-15 14:37:07.067  4354  4354 I art     :   at android.app.IActivityManager$ContentProviderHolder android.app.ActivityThread.installProvider(android.content.Context, android.app.IActivityManager$ContentProviderHolder, android.content.pm.ProviderInfo, boolean, boolean, boolean) (ActivityThread.java:5811)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.installContentProviders(android.content.Context, java.util.List) (ActivityThread.java:5403)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.handleBindApplication(android.app.ActivityThread$AppBindData) (ActivityThread.java:5342)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.-wrap2(android.app.ActivityThread, android.app.ActivityThread$AppBindData) (ActivityThread.java:-1)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1528)
11-15 14:37:07.067  4354  4354 I art     :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
11-15 14:37:07.067  4354  4354 I art     :   at void android.os.Looper.loop() (Looper.java:154)
11-15 14:37:07.067  4354  4354 I art     :   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
11-15 14:37:07.067  4354  4354 I art     :   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
11-15 14:37:07.067  4354  4354 I art     :   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
11-15 14:37:07.067  4354  4354 I art     :   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
11-15 14:37:07.067  4354  4354 I art     :
11-15 14:37:07.083  4354  4372 D Pushwoosh: [CrashAnalytics] Looking for exceptions in: /data/user/0/com.homeismobile/files
11-15 14:37:07.090  4354  4354 I Pushwoosh: Log level: DEBUG
.....
11-15 14:37:07.932  4354  4407 W art     : Before Android 4.1, method boolean com.facebook.share.widget.ShareButtonBase.canShare() would have incorrectly overridden the package-private method in android.widget.TextView
11-15 14:37:07.935  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
11-15 14:37:07.936  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
11-15 14:37:07.937  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
11-15 14:37:07.938  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
11-15 14:37:07.938  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
11-15 14:37:07.938  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
11-15 14:37:07.940  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager
11-15 14:37:07.945  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
11-15 14:37:07.947  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
11-15 14:37:07.949  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
11-15 14:37:07.951  4354  4354 W         : Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
11-15 14:37:07.955  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
11-15 14:37:07.955  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
11-15 14:37:07.959  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
11-15 14:37:07.959  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
11-15 14:37:07.960  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
11-15 14:37:07.961  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
11-15 14:37:07.961  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
11-15 14:37:07.961  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
11-15 14:37:07.963  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
11-15 14:37:07.965  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.toolbar.ReactToolbarManager
11-15 14:37:07.966  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.webview.ReactWebViewManager
11-15 14:37:07.967  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
11-15 14:37:07.968  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
11-15 14:37:07.968  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode
11-15 14:37:07.968  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
11-15 14:37:07.968  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
11-15 14:37:07.969  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
11-15 14:37:07.970  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
11-15 14:37:07.971  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
11-15 14:37:07.971  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
11-15 14:37:07.972  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
11-15 14:37:07.979  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
11-15 14:37:07.982  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
11-15 14:37:07.982  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
11-15 14:37:07.983  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
11-15 14:37:07.983  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
11-15 14:37:07.984  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
11-15 14:37:07.984  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.brentvatne.react.ReactVideoViewManager
11-15 14:37:07.986  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLikeViewManager
11-15 14:37:07.986  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBLoginButtonManager
11-15 14:37:07.987  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBSendButtonManager
11-15 14:37:07.988  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.reactnative.androidsdk.FBShareButtonManager
11-15 14:37:07.989  4354  4407 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.github.alinz.reactnativewebviewbridge.WebViewBridgeManager
11-15 14:37:07.991  4354  4408 D         : HostConnection::get() New Host Connection established 0x8f1583c0, tid 4408
11-15 14:37:08.038  4354  4407 D ReactNative: Initializing React Xplat Bridge.
11-15 14:37:08.043  4354  4408 W         : Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1
....
11-15 14:37:18.644  4354  4382 I Pushwoosh: |     Pushwoosh request:
11-15 14:37:18.644  4354  4382 I Pushwoosh: | Url: https://cp.pushwoosh.com/json/1.3/registerDevice
11-15 14:37:18.644  4354  4382 I Pushwoosh: | Payload: {"request":{"application":"","hwid":"168eaa5baa284188","v":"5.1.1","device_type":3,"device_name":"Phone","language":"en","timezone":7200,"android_package":"com.homeismobile","jailbroken":1,"device_model":"Google Android SDK built for x86","os_version":"7.0","app_version":"1.0.2","push_token":"eAkcLhyqE0E:APA91bE0zOhcW1r_oyPplb13c5m2FGBMi6mqjKajGkDuiPmQBk7WmugeUdRXe1L-W0nZ21cf9ihkmoRAU02PrNwMqjvMahlSDrtQlFD7n3ZWX5nYIoqE73WdaOR7gQDRTTKCjX1RqRC9","sounds":"[]"}}
11-15 14:37:18.644  4354  4382 I Pushwoosh: | Response: {"status_code":210,"status_message":"Application not found","response":null}
11-15 14:37:18.644  4354  4382 I Pushwoosh: x
11-15 14:37:18.645  4354  4382 E Pushwoosh: [RequestManager] ERROR: {"status_code":210,"status_message":"Application not found","response":null}
11-15 14:37:18.645  4354  4382 E Pushwoosh: com.pushwoosh.internal.network.NetworkException: {"status_code":210,"status_message":"Application not found","response":null}
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at com.pushwoosh.internal.network.d.a(Unknown Source)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at com.pushwoosh.internal.network.d.a(Unknown Source)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at com.pushwoosh.internal.network.d.a(Unknown Source)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at com.pushwoosh.internal.network.e.run(Unknown Source)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at com.pushwoosh.PushwooshService.onHandleWork(Unknown Source)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:386)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:377)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at android.os.AsyncTask$2.call(AsyncTask.java:304)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
11-15 14:37:18.645  4354  4382 E Pushwoosh: 	at java.lang.Thread.run(Thread.java:761)
.......

And after a while the app crashes....

image

@rotemmiz
Copy link
Member

Does it work without Detox, in release or in debug ? This log doesn't seem to include any traces of Detox code in it.

You attached a log with multiple crashes, most notable one is from pushwoosh's stack

4354 I art     : Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.job.JobServiceEngine" on path:

not sure what's going on there.

The screenshot shows an app that its main thread is too busy to respond to user interactions (called ANR). This is not a crash...

@ilonashub
Copy link
Author

ilonashub commented Nov 19, 2017

Both of the APK work correctly in the emulator when I just copy paste it there.

Regarding the logs - I copied only the error lines from the log - there are a few hundreds of lines there (including detox..).
I also suspect that pushwoosh is the most suspicious... but wondered if maybe some of the other errors might look familiar to you.
Yeah, not a crash - it's just stuck in the init phase of detox.

@simonracz
Copy link
Contributor

simonracz commented Nov 19, 2017

Hey @ilonashub ,

Please run the following command, while the target simulator is booted up, and share it's output with me:

adb shell pm list instrumentation

Please also share the output of:

ls android/app/build/outputs/apk/

Also, please share the whole adb logcat output with us, it doesn't matter how big it is. ( There is a button here somewhere that enables uploading a txt file, you don’t have to copy paste it. ) I can only guess without that.

Thanks,
Simon

@ilonashub
Copy link
Author

Hey @simonracz, sorry for the delay... here are the outputs:

adb shell pm list instrumentation:

instrumentation:com.RNFetchBlob.test/android.test.InstrumentationTestRunner (target=com.RNFetchBlob.test)
instrumentation:com.android.emulator.smoketests/android.support.test.runner.AndroidJUnitRunner (target=com.android.emulator.smoketests)
instrumentation:com.android.smoketest.tests/com.android.smoketest.SmokeTestRunner (target=com.android.smoketest)
instrumentation:com.apsl.versionnumber.test/android.test.InstrumentationTestRunner (target=com.apsl.versionnumber.test)
instrumentation:com.brentvatne.react.test/android.test.InstrumentationTestRunner (target=com.brentvatne.react.test)
instrumentation:com.example.android.apis/.app.LocalSampleInstrumentation (target=com.example.android.apis)
instrumentation:com.facebook.reactnative.androidsdk.test/android.test.InstrumentationTestRunner (target=com.facebook.reactnative.androidsdk.test)
instrumentation:com.github.alinz.reactnativewebviewbridge.test/android.test.InstrumentationTestRunner (target=com.github.alinz.reactnativewebviewbridge.test)
instrumentation:com.github.yamill.orientation.test/android.test.InstrumentationTestRunner (target=com.github.yamill.orientation.test)
instrumentation:com.homeismobile.test/android.support.test.runner.AndroidJUnitRunner (target=com.homeismobile)
instrumentation:com.imagepicker.test/android.test.InstrumentationTestRunner (target=com.imagepicker.test)
instrumentation:com.kevinejohn.RNMixpanel.test/android.test.InstrumentationTestRunner (target=com.kevinejohn.RNMixpanel.test)
instrumentation:com.learnium.RNDeviceInfo.test/android.test.InstrumentationTestRunner (target=com.learnium.RNDeviceInfo.test)
instrumentation:com.microsoft.codepush.react.test/android.test.InstrumentationTestRunner (target=com.microsoft.codepush.react.test)
instrumentation:com.oblador.vectoricons.test/android.test.InstrumentationTestRunner (target=com.oblador.vectoricons.test)
instrumentation:com.pushwoosh.reactnativeplugin.test/android.test.InstrumentationTestRunner (target=com.pushwoosh.reactnativeplugin.test)
instrumentation:com.smixx.fabric.test/android.test.InstrumentationTestRunner (target=com.smixx.fabric.test)
instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell)

ls android/app/build/outputs/apk/:

app-dev-release-androidTest.apk   app-release-androidTest.apk       app-stage-release-androidTest.apk
app-dev-release.apk               app-release.apk                   app-stage-release.apk

logcat.txt

@simonracz
Copy link
Contributor

simonracz commented Nov 22, 2017

Hey @ilonashub ,

I went through the logs.

The instrumentation is built and started correctly. I see that detox starts normally.

The issue is always an ANR in Pushwoosh :

ActivityManager: Timeout executing service: ServiceRecord{31d0746 u0 com.homeismobile/com.pushwoosh.PushwooshService

I see other Pushwoosh related errors in the log, but if as you said, the app works without detox, then they might conflict with each other somehow. I have no idea yet how.

My last idea is, could you please take a look at this?

And run the test with the following command:

detox test -c android.emu.release --debug-synchronization 300

Thanks,
Simon

@ilonashub
Copy link
Author

Thanks for the quick response!
So I ran the build again and made sure that if I open the installed app on the emulator it runs properly.

When I ran detox test -c android.emu.release --debug-synchronization 300 nothing changed... It looks like it's not able to open the app when I ran the detox test.

The output for detox test --configuration android.emu.release --debug-synchronization 300 --loglevel verbose:

detox-server info 12:10:11: server listening on localhost:60281...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"5d7b0205-0ed4-15d9-e902-cf8ace063f4e","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"5d7b0205-0ed4-15d9-e902-cf8ace063f4e","role":"tester"},"messageId":0}
detox verb ws
detox verb 1: /Users/ilonashub/Library/Android/sdk/tools/emulator -list-avds --verbose
detox verb 1: stdout: Nexus_5X_API_23
detox verb 1: stdout: Nexus_5X_API_24
detox verb 1: stdout:
detox verb Emulator stdout:  emulator: Android virtual device file at: /Users/ilonashub/.android/avd/Nexus_5X_API_24.ini
detox verb Emulator stdout:  emulator: virtual device content at /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd
detox verb Emulator stdout:  emulator: virtual device config file: /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/config.ini
detox verb Emulator stdout:  emulator: using core hw config path: /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/hardware-qemu.ini
detox verb Emulator stdout:  emulator: Found AVD target API level: 24
detox verb Emulator stdout:  emulator: Read property file at /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//build.prop
detox verb Emulator stdout:  emulator: No boot.prop property file found.
detox verb Emulator stdout:  emulator: found skin 'nexus_5x' in directory: /Users/ilonashub/Library/Android/sdk/skins/
detox verb Emulator stdout:  emulator: autoconfig: -skin nexus_5x
detox verb Emulator stdout:  emulator: autoconfig: -skindir /Users/ilonashub/Library/Android/sdk/skins/
detox verb Emulator stdout:  emulator: autoconfig: -kernel /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//kernel-ranchu
detox verb Emulator stdout:  emulator: Target arch = 'x86'
detox verb Emulator stdout:  emulator: Auto-config: -qemu -cpu qemu32
detox verb Emulator stdout:  emulator: Auto-detect: Kernel image requires new device naming scheme.
detox verb Emulator stdout:  emulator: Auto-detect: Kernel does not support YAFFS2 partitions.
detox verb Emulator stdout:  emulator: autoconfig: -ramdisk /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//ramdisk.img
detox verb Emulator stdout:  emulator: Using initial system image: /Users/ilonashub/Library/Android/sdk//system-images/android-24/google_apis_playstore/x86//system.img
detox verb Emulator stdout:  emulator: No vendor image
detox verb Emulator stdout:  emulator: autoconfig: -data /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/userdata-qemu.img
detox verb Emulator stdout:  emulator: autoconfig: -initdata /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/userdata.img
detox verb Emulator stdout:  emulator: autoconfig: -cache /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/cache.img
detox verb Emulator stdout:  emulator: autoconfig: -sdcard /Users/ilonashub/.android/avd/Nexus_5X_API_24.avd/sdcard.img
detox verb Emulator stdout:  emulator: Physical RAM size: 1536MB
detox verb Emulator stdout:
detox verb Emulator stdout:  emulator: VM heap size 256MB is below hardware specified minimum of 384MB,setting it to that value
detox verb Emulator stdout:  emulator: System image is read only
detox verb Emulator stdout:  emulator: Found 2 DNS servers: 192.115.106.35 62.219.186.7
detox verb Emulator stdout:  emulator: ERROR: There's another emulator instance running with the current AVD 'Nexus_5X_API_24'. Exiting...
detox verb Emulator stdout:
detox verb Emulator stdout:
detox verb 2: /Users/ilonashub/Library/Android/sdk/platform-tools/adb  devices
detox verb 2: stdout: List of devices attached
detox verb 2: stdout: emulator-5554	device
detox verb 2: stdout:
detox verb 2: stdout:
detox verb 3: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell input keyevent 82
detox verb 4: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.homeismobile
detox verb 4: stdout: Success
detox verb 4: stdout:
detox verb 5: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 uninstall com.homeismobile.test
detox verb 5: stdout: Success
detox verb 5: stdout:
detox verb 6: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/ilonashub/homeis/home-is-mobile/android/app/build/outputs/apk/app-release.apk
detox verb 6: stderr: Success
detox verb 6: stderr:
detox verb 7: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 install -r -g /Users/ilonashub/homeis/home-is-mobile/android/app/build/outputs/apk/app-release-androidTest.apk
detox verb 7: stderr: Success
detox verb 7: stderr:
detox verb 8: /Users/ilonashub/Library/Android/sdk/platform-tools/adb -s emulator-5554 shell am force-stop com.homeismobile
detox verb adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:60281 -e detoxSessionId 5d7b0205-0ed4-15d9-e902-cf8ace063f4e -e debug false com.homeismobile.test/android.support.test.runner.AndroidJUnitRunner
detox verb Instrumentation spawned, childProcess.pid:  64513
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.homeismobile.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.homeismobile.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:

and after a few minutes I start to see mocha's timeouts...

@KubaGL
Copy link

KubaGL commented Nov 28, 2017

Any progress here? I have exactly the same problem.

@simonracz
Copy link
Contributor

Hey @KubaGL , could you please attach a complete log too?

@KubaGL
Copy link

KubaGL commented Jan 10, 2018

Sorry but I switched to other tool, so I don't have a code with detox anymore.

@llostris
Copy link

llostris commented Jan 18, 2018

Any updates on this? I have the same issue.
detox-issue-log.txt
detox-issue-logcat.txt

@Milesyan
Copy link

Milesyan commented Feb 5, 2018

Same issue, and here is the adb logcat:
detox_logcat.txt

@mironiasty
Copy link
Contributor

I had similar issue when running it on Android Device. Turns out I had to manually run adb reverse tcp:XXXXX tcp:XXXXX after starting detox test (where XXXXX is port number used by detox server).

@Milesyan based on your logs, I guess you might have same issue.

I can create PR that would always run adb reverse when using android device driver, if this is correct solution for this problem.

@skv-headless
Copy link

In my case problem was in react-native-device-info package. When react-native-device-info is imported this bug happens. I just stubbed import for test environment and it works again.

@Milesyan
Copy link

@skv-headless thanks! It is just the case. I removed the import of react-native-device-info and everything works fine!

@machour
Copy link

machour commented Feb 24, 2018

@skv-headless I've pinpointed the problem of react-native-device-info to this line in the native module:

     constants.put("userAgent", WebSettings.getDefaultUserAgent(this.reactContext));

This line make detox hang forever. If I comment it out, the detox test runs fine.
Any clues on what might be going on ? 🤔

@rotemmiz
Copy link
Member

Does the app crash?
Please add logcat output

@machour
Copy link

machour commented Feb 24, 2018

Here's the complete logcat output: https://pastebin.com/LGK4zhYC

@blumendorf made a repository to reproduce this problem:
https://github.com/ewyso/react-native-detox-e-android

I'm running detox this way:

./node_modules/.bin/detox build --configuration android.emu.debug && ./node_modules/.bin/detox test --configuration android.emu.debug -l verbose  --debug-synchronization 30000

and it runs fine unless react-native-device-info is imported (uncomment App.js line 18).

@AvivRubys
Copy link

I can confirm @machour's findings, I have the same issue and the culprit is the WebSettings line for me aswell in react-native-device-info.
Anything we can do further to help diagnose this?

@ksmahesh
Copy link

I too am blocked on the same issue. Introducing react-native-device-info broke all the tests

@compojoom
Copy link

It took me a day to come to the same conclusion, but yea - it's RNDeviceInfo. The second I remove it from mainApplication.java and the tests start on android.

doing @machour's change also fixes the issue. Is this something that detox can go around or should we look for ways to fix this in RNDEviceInfo? I don't see anything out of the ordinary that deviceInfo does. https://developer.android.com/reference/android/webkit/WebSettings

@krazykira
Copy link

Any update on this as @ilonashub . i am getting the same behaviour here. the app launches but gets stuck and no tests are performed. Everything works fine when i use the emulator. btw i already did

adb reverse tcp:8081 tcp:8081

The log that is displayed by detox test -c android.emu.debug - --debug-synchronization 300 -l verbose

node_modules/.bin/mocha e2e --opts e2e/mocha.opts --configuration android.emu.debug --loglevel verbose   --debug-synchronization 300 --grep :ios: --invert  


detox-server info 12:48:05: server listening on localhost:55634...
detox verb ws onOpen [object Object]
detox verb ws send: {"type":"login","params":{"sessionId":"959956bd-ac16-cb2b-4b3d-7e65f60126f2","role":"tester"},"messageId":0}
detox verb ws onMessage: {"type":"loginSuccess","params":{"sessionId":"959956bd-ac16-cb2b-4b3d-7e65f60126f2","role":"tester"},"messageId":0}
detox verb ws  
detox verb 1: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb  devices 
detox verb 1: stdout: List of devices attached
detox verb 1: stdout: 0815f82b25841905	device
detox verb 1: stdout: 
detox verb 1: stdout: 
detox verb 2: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 shell input keyevent 82 
detox verb 3: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 uninstall com.goreadymade 
detox verb 3: stdout: Success
detox verb 3: stdout: 
detox verb 4: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 uninstall com.goreadymade.test 
detox verb 4: stdout: Success
detox verb 4: stdout: 
detox verb 5: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 shell getprop ro.build.version.sdk 
detox verb 5: stdout: 24
detox verb 5: stdout: 
detox verb 6: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 install -r -g /Users/sherazahmadkhilji/ReactNative/GoReadyMade/android/app/build/outputs/apk/debug/app-debug.apk 
detox verb 6: stdout: Success
detox verb 6: stdout: 
detox verb 7: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 shell getprop ro.build.version.sdk 
detox verb 7: stdout: 24
detox verb 7: stdout: 
detox verb 8: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 install -r -g /Users/sherazahmadkhilji/ReactNative/GoReadyMade/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk 
detox verb 8: stdout: Success
detox verb 8: stdout: 
detox verb 9: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 shell am force-stop com.goreadymade 
detox verb 10: /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 shell pm list instrumentation 
detox verb 10: stdout: instrumentation:com.goreadymade.test/android.support.test.runner.AndroidJUnitRunner (target=com.goreadymade)
detox verb 10: stdout: instrumentation:com.microsoft.office.excel/android.test.InstrumentationTestRunner (target=com.microsoft.office.msohttp.tests)
detox verb 10: stdout: instrumentation:com.microsoft.office.onenote/android.test.InstrumentationTestRunner (target=com.microsoft.office.msohttp.tests)
detox verb 10: stdout: instrumentation:com.microsoft.office.word/android.test.InstrumentationTestRunner (target=com.microsoft.office.msohttp.tests)
detox verb 10: stdout: instrumentation:com.microsoft.office.powerpoint/android.test.InstrumentationTestRunner (target=com.microsoft.office.msohttp.tests)
detox verb 10: stdout: 
detox verb /Users/sherazahmadkhilji/Library/Android/sdk/platform-tools/adb -s 0815f82b25841905 shell am instrument -w -r -e detoxServer ws://localhost:55634 -e detoxSessionId 959956bd-ac16-cb2b-4b3d-7e65f60126f2 -e debug false com.goreadymade.test/android.support.test.runner.AndroidJUnitRunner 
detox verb Instrumentation spawned, childProcess.pid:  11023
detox verb ws send: {"type":"isReady","params":{},"messageId":-1000}
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: numtests=1
detox verb Instrumentation stdout:  
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: stream=
detox verb Instrumentation stdout:  com.goreadymade.DetoxTest:
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: test=runDetoxTests
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: class=com.goreadymade.DetoxTest
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS: current=1
detox verb Instrumentation stdout:  INSTRUMENTATION_STATUS_CODE: 1
detox verb Instrumentation stdout:  

  0 passing (2m)

  1) "before all" hook
detox verb instrumentationProcess terminated due to receipt of signal SIGTERM 

@ghsdh3409
Copy link

ghsdh3409 commented May 8, 2018

My problem also is due to react-native-device-info. As this comment, they are still trying to figure out.

I temporary fix it by stubbing WebSettings.getDefaultUserAgent() using mockito-android in my Detox test code.

@Test
public void runDetoxTests() throws InterruptedException {
  Context reactContext = InstrumentationRegistry.getTargetContext().getApplicationContext();
  WebSettings webSettings = spy(WebSettings.class);
  doReturn("getDefaultUserAgentMock").when(webSettings).getDefaultUserAgent(reactContext);

  Detox.runTests(mActivityRule);
}

@esusslin
Copy link

esusslin commented May 9, 2018

I am currently experiencing the exact issue @krazykira is facing.

Any update on this?

@kormang
Copy link

kormang commented May 16, 2018

@ghsdh3409 's answer fixed it for me.

I had to put:
androidTestImplementation 'org.mockito:mockito-android:2.7.22' to app/build.gradle
or for previous versions of gradle:
androidTestCompile 'org.mockito:mockito-android:2.7.22'

These are imports:

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.webkit.WebSettings;
import static org.mockito.Mockito.*;

And at the end, I have put @ghsdh3409 's code in DetoxTest.java from androidTest directory.

(For those lazy like me, so that you don't have to look for your correct imports yourself :) )

@compojoom
Copy link

thanks @ghsdh3409 @kormang - tests are finally launching on android!

@stale
Copy link

stale bot commented Jun 30, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.

@stale
Copy link

stale bot commented Jul 7, 2018

The issue has been closed for inactivity.

@stale stale bot closed this as completed Jul 7, 2018
@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests