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

[Android] LaunchApp with newInstance: false fails #669

Closed
kristfal opened this issue Apr 11, 2018 · 8 comments
Closed

[Android] LaunchApp with newInstance: false fails #669

kristfal opened this issue Apr 11, 2018 · 8 comments

Comments

@kristfal
Copy link

kristfal commented Apr 11, 2018

Description

Steps to Reproduce

This is our code:

it('should launch in a logged in state with a valid login token', async () => {
    await device.launchApp({permissions: {location: 'always'}});

    // Removed declarations

    await device.launchApp({
      newInstance: false,
      url: `ioletsembark://login/token/${token}`,
    });

    await waitFor(menuButton)
      .toExist()
      .withTimeout(INITIAL_SCREEN_TIMEOUT);
  });

The above code will fail with the following notice:

Error: Could not launch intent Intent { act=android.intent.action.VIEW dat=ioletsembark://login/token/<REDACTED> flg=0x10000000 cmp=com.isea.Embark/.MainActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1523458140008 and now the last time the queue went idle was: 1523458185572. If these numbers are the same your activity might be hogging the event queue.

Setting newInstance: true resolves the issue. iOS works just fine.

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 7.3.3
  • React Native: 0.51.0
  • Node: 8
  • Device: Android Nexus 6 emulator (avd -n Nexus6 -k "system-images;android-26;google_apis;x86" -b x86 -c 100M -d 7 -f
  • Xcode: Irrelevant
  • macOS: Sierra 10.12.6

Device and verbose Detox logs

$ detox test -c android.emu.debug --loglevel verbose
node_modules/.bin/jest e2e --config=__e2e__/config.json --runInBand --testNamePattern='^((?!:ios:).)*$'
 server listening on localhost:54991...
 onOpen [object Object]
 send: {"type":"login","params":{"sessionId":"a11f7ce0-f72f-bc41-3072-996ca27b2422","role":"tester"},"messageId":0}
 onMessage: {"type":"loginSuccess","params":{"sessionId":"a11f7ce0-f72f-bc41-3072-996ca27b2422","role":"tester"},"messageId":0}
  rbx
 : /Users/kristianfallro/android-sdk-macosx/tools/emulator -list-avds --verbose
 Nexus6ut:
 : stdout:
 -verbose -gpu host -no-audio @Nexus6osx/tools/emulator
 : /Users/kristianfallro/android-sdk-macosx/platform-tools/adb  devices
 List of devices attached
 emulator-5554	device
 : stdout:
 : stdout:
3: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554  hell getprop dev.bootcomplete
 1 stdout:
 : stdout:
4: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554  hell input keyevent 82
5: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554  ninstall com.isea.Embark
 Successt:
 : stdout:
6: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554  ninstall com.isea.Embark.test
 Successt:
 : stdout:
7: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554  hell getprop ro.build.version.sdk
 21stdout:
 : stdout:
8: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554 install -rg /Users/kristianfallro/Projects/embark-native/android/app/build/outpu s/apk/debug/app-debug.apk
 [  0%] /data/local/tmp/app-debug.apk
 [  0%] /data/local/tmp/app-debug.apk
 [  0%] /data/local/tmp/app-debug.apk
 [  1%] /data/local/tmp/app-debug.apk
 [  1%] /data/local/tmp/app-debug.apk
 [  1%] /data/local/tmp/app-debug.apk
 [  1%] /data/local/tmp/app-debug.apk
 [  2%] /data/local/tmp/app-debug.apk
 [  2%] /data/local/tmp/app-debug.apk
 [  2%] /data/local/tmp/app-debug.apk
 [  3%] /data/local/tmp/app-debug.apk
 [  3%] /data/local/tmp/app-debug.apk
 [  3%] /data/local/tmp/app-debug.apk
 [  3%] /data/local/tmp/app-debug.apk
 [  4%] /data/local/tmp/app-debug.apk
 [  4%] /data/local/tmp/app-debug.apk
 [  4%] /data/local/tmp/app-debug.apk
 [  4%] /data/local/tmp/app-debug.apk
 [  5%] /data/local/tmp/app-debug.apk
 [  5%] /data/local/tmp/app-debug.apk
 [  5%] /data/local/tmp/app-debug.apk
 [  6%] /data/local/tmp/app-debug.apk
 [  6%] /data/local/tmp/app-debug.apk
 [  6%] /data/local/tmp/app-debug.apk
 [  6%] /data/local/tmp/app-debug.apk
 [  7%] /data/local/tmp/app-debug.apk
 [  7%] /data/local/tmp/app-debug.apk
 [  7%] /data/local/tmp/app-debug.apk
 [  8%] /data/local/tmp/app-debug.apk
 [  8%] /data/local/tmp/app-debug.apk
 [  8%] /data/local/tmp/app-debug.apk
 [  8%] /data/local/tmp/app-debug.apk
 [  9%] /data/local/tmp/app-debug.apk
 [  9%] /data/local/tmp/app-debug.apk
 [  9%] /data/local/tmp/app-debug.apk
 [  9%] /data/local/tmp/app-debug.apk
 [ 10%] /data/local/tmp/app-debug.apk
 [ 10%] /data/local/tmp/app-debug.apk
 [ 10%] /data/local/tmp/app-debug.apk
 [ 11%] /data/local/tmp/app-debug.apk
 [ 11%] /data/local/tmp/app-debug.apk
 [ 11%] /data/local/tmp/app-debug.apk
 [ 11%] /data/local/tmp/app-debug.apk
 [ 12%] /data/local/tmp/app-debug.apk
 [ 12%] /data/local/tmp/app-debug.apk
 [ 12%] /data/local/tmp/app-debug.apk
 [ 13%] /data/local/tmp/app-debug.apk
 [ 13%] /data/local/tmp/app-debug.apk
 [ 13%] /data/local/tmp/app-debug.apk
 [ 13%] /data/local/tmp/app-debug.apk
 [ 14%] /data/local/tmp/app-debug.apk
 [ 14%] /data/local/tmp/app-debug.apk
 [ 14%] /data/local/tmp/app-debug.apk
 [ 14%] /data/local/tmp/app-debug.apk
 [ 15%] /data/local/tmp/app-debug.apk
 [ 15%] /data/local/tmp/app-debug.apk
 [ 15%] /data/local/tmp/app-debug.apk
 [ 16%] /data/local/tmp/app-debug.apk
 [ 16%] /data/local/tmp/app-debug.apk
 [ 16%] /data/local/tmp/app-debug.apk
 [ 16%] /data/local/tmp/app-debug.apk
 [ 17%] /data/local/tmp/app-debug.apk
 [ 17%] /data/local/tmp/app-debug.apk
 [ 17%] /data/local/tmp/app-debug.apk
 [ 18%] /data/local/tmp/app-debug.apk
 [ 18%] /data/local/tmp/app-debug.apk
 [ 18%] /data/local/tmp/app-debug.apk
 [ 18%] /data/local/tmp/app-debug.apk
 [ 19%] /data/local/tmp/app-debug.apk
 [ 19%] /data/local/tmp/app-debug.apk
 [ 19%] /data/local/tmp/app-debug.apk
 [ 19%] /data/local/tmp/app-debug.apk
 [ 20%] /data/local/tmp/app-debug.apk
 [ 20%] /data/local/tmp/app-debug.apk
 [ 20%] /data/local/tmp/app-debug.apk
 [ 21%] /data/local/tmp/app-debug.apk
 [ 21%] /data/local/tmp/app-debug.apk
 [ 21%] /data/local/tmp/app-debug.apk
 [ 21%] /data/local/tmp/app-debug.apk
 [ 22%] /data/local/tmp/app-debug.apk
 [ 22%] /data/local/tmp/app-debug.apk
 [ 22%] /data/local/tmp/app-debug.apk
 [ 23%] /data/local/tmp/app-debug.apk
 [ 23%] /data/local/tmp/app-debug.apk
 [ 23%] /data/local/tmp/app-debug.apk
 [ 23%] /data/local/tmp/app-debug.apk
 [ 24%] /data/local/tmp/app-debug.apk
 [ 24%] /data/local/tmp/app-debug.apk
 [ 24%] /data/local/tmp/app-debug.apk
 [ 24%] /data/local/tmp/app-debug.apk
 [ 25%] /data/local/tmp/app-debug.apk
 [ 25%] /data/local/tmp/app-debug.apk
 [ 25%] /data/local/tmp/app-debug.apk
 [ 26%] /data/local/tmp/app-debug.apk
 [ 26%] /data/local/tmp/app-debug.apk
 [ 26%] /data/local/tmp/app-debug.apk
 [ 26%] /data/local/tmp/app-debug.apk
 [ 27%] /data/local/tmp/app-debug.apk
 [ 27%] /data/local/tmp/app-debug.apk
 [ 27%] /data/local/tmp/app-debug.apk
 [ 28%] /data/local/tmp/app-debug.apk
 [ 28%] /data/local/tmp/app-debug.apk
 [ 28%] /data/local/tmp/app-debug.apk
 [ 28%] /data/local/tmp/app-debug.apk
 [ 29%] /data/local/tmp/app-debug.apk
 [ 29%] /data/local/tmp/app-debug.apk
 [ 29%] /data/local/tmp/app-debug.apk
 [ 29%] /data/local/tmp/app-debug.apk
 [ 30%] /data/local/tmp/app-debug.apk
 [ 30%] /data/local/tmp/app-debug.apk
 [ 30%] /data/local/tmp/app-debug.apk
 [ 31%] /data/local/tmp/app-debug.apk
 [ 31%] /data/local/tmp/app-debug.apk
 [ 31%] /data/local/tmp/app-debug.apk
 [ 31%] /data/local/tmp/app-debug.apk
 [ 32%] /data/local/tmp/app-debug.apk
 [ 32%] /data/local/tmp/app-debug.apk
 [ 32%] /data/local/tmp/app-debug.apk
 [ 33%] /data/local/tmp/app-debug.apk
 [ 33%] /data/local/tmp/app-debug.apk
 [ 33%] /data/local/tmp/app-debug.apk
 [ 33%] /data/local/tmp/app-debug.apk
 [ 34%] /data/local/tmp/app-debug.apk
 [ 34%] /data/local/tmp/app-debug.apk
 [ 34%] /data/local/tmp/app-debug.apk
 [ 34%] /data/local/tmp/app-debug.apk
 [ 35%] /data/local/tmp/app-debug.apk
 [ 35%] /data/local/tmp/app-debug.apk
 [ 35%] /data/local/tmp/app-debug.apk
 [ 36%] /data/local/tmp/app-debug.apk
 [ 36%] /data/local/tmp/app-debug.apk
 [ 36%] /data/local/tmp/app-debug.apk
 [ 36%] /data/local/tmp/app-debug.apk
 [ 37%] /data/local/tmp/app-debug.apk
 [ 37%] /data/local/tmp/app-debug.apk
 [ 37%] /data/local/tmp/app-debug.apk
 [ 38%] /data/local/tmp/app-debug.apk
 [ 38%] /data/local/tmp/app-debug.apk
 [ 38%] /data/local/tmp/app-debug.apk
 [ 38%] /data/local/tmp/app-debug.apk
 [ 39%] /data/local/tmp/app-debug.apk
 [ 39%] /data/local/tmp/app-debug.apk
 [ 39%] /data/local/tmp/app-debug.apk
 [ 39%] /data/local/tmp/app-debug.apk
 [ 40%] /data/local/tmp/app-debug.apk
 [ 40%] /data/local/tmp/app-debug.apk
 [ 40%] /data/local/tmp/app-debug.apk
 [ 41%] /data/local/tmp/app-debug.apk
 [ 41%] /data/local/tmp/app-debug.apk
 [ 41%] /data/local/tmp/app-debug.apk
 [ 41%] /data/local/tmp/app-debug.apk
 [ 42%] /data/local/tmp/app-debug.apk
 [ 42%] /data/local/tmp/app-debug.apk
 [ 42%] /data/local/tmp/app-debug.apk
 [ 43%] /data/local/tmp/app-debug.apk
 [ 43%] /data/local/tmp/app-debug.apk
 [ 43%] /data/local/tmp/app-debug.apk
 [ 43%] /data/local/tmp/app-debug.apk
 [ 44%] /data/local/tmp/app-debug.apk
 [ 44%] /data/local/tmp/app-debug.apk
 [ 44%] /data/local/tmp/app-debug.apk
 [ 44%] /data/local/tmp/app-debug.apk
 [ 45%] /data/local/tmp/app-debug.apk
 [ 45%] /data/local/tmp/app-debug.apk
 [ 45%] /data/local/tmp/app-debug.apk
 [ 46%] /data/local/tmp/app-debug.apk
 [ 46%] /data/local/tmp/app-debug.apk
 [ 46%] /data/local/tmp/app-debug.apk
 [ 46%] /data/local/tmp/app-debug.apk
 [ 47%] /data/local/tmp/app-debug.apk
 [ 47%] /data/local/tmp/app-debug.apk
 [ 47%] /data/local/tmp/app-debug.apk
 [ 48%] /data/local/tmp/app-debug.apk
 [ 48%] /data/local/tmp/app-debug.apk
 [ 48%] /data/local/tmp/app-debug.apk
 [ 48%] /data/local/tmp/app-debug.apk
 [ 49%] /data/local/tmp/app-debug.apk
 [ 49%] /data/local/tmp/app-debug.apk
 [ 49%] /data/local/tmp/app-debug.apk
 [ 49%] /data/local/tmp/app-debug.apk
 [ 50%] /data/local/tmp/app-debug.apk
 [ 50%] /data/local/tmp/app-debug.apk
 [ 50%] /data/local/tmp/app-debug.apk
 [ 51%] /data/local/tmp/app-debug.apk
 [ 51%] /data/local/tmp/app-debug.apk
 [ 51%] /data/local/tmp/app-debug.apk
 [ 51%] /data/local/tmp/app-debug.apk
 [ 52%] /data/local/tmp/app-debug.apk
 [ 52%] /data/local/tmp/app-debug.apk
 [ 52%] /data/local/tmp/app-debug.apk
 [ 53%] /data/local/tmp/app-debug.apk
 [ 53%] /data/local/tmp/app-debug.apk
 [ 53%] /data/local/tmp/app-debug.apk
 [ 53%] /data/local/tmp/app-debug.apk
 [ 54%] /data/local/tmp/app-debug.apk
 [ 54%] /data/local/tmp/app-debug.apk
 [ 54%] /data/local/tmp/app-debug.apk
 [ 54%] /data/local/tmp/app-debug.apk
 [ 55%] /data/local/tmp/app-debug.apk
 [ 55%] /data/local/tmp/app-debug.apk
 [ 55%] /data/local/tmp/app-debug.apk
 [ 56%] /data/local/tmp/app-debug.apk
 [ 56%] /data/local/tmp/app-debug.apk
 [ 56%] /data/local/tmp/app-debug.apk
 [ 56%] /data/local/tmp/app-debug.apk
 [ 57%] /data/local/tmp/app-debug.apk
 [ 57%] /data/local/tmp/app-debug.apk
 [ 57%] /data/local/tmp/app-debug.apk
 [ 58%] /data/local/tmp/app-debug.apk
 [ 58%] /data/local/tmp/app-debug.apk
 [ 58%] /data/local/tmp/app-debug.apk
 [ 58%] /data/local/tmp/app-debug.apk
 [ 59%] /data/local/tmp/app-debug.apk
 [ 59%] /data/local/tmp/app-debug.apk
 [ 59%] /data/local/tmp/app-debug.apk
 [ 59%] /data/local/tmp/app-debug.apk
 [ 60%] /data/local/tmp/app-debug.apk
 [ 60%] /data/local/tmp/app-debug.apk
 [ 60%] /data/local/tmp/app-debug.apk
 [ 61%] /data/local/tmp/app-debug.apk
 [ 61%] /data/local/tmp/app-debug.apk
 [ 61%] /data/local/tmp/app-debug.apk
 [ 61%] /data/local/tmp/app-debug.apk
 [ 62%] /data/local/tmp/app-debug.apk
 [ 62%] /data/local/tmp/app-debug.apk
 [ 62%] /data/local/tmp/app-debug.apk
 [ 63%] /data/local/tmp/app-debug.apk
 [ 63%] /data/local/tmp/app-debug.apk
 [ 63%] /data/local/tmp/app-debug.apk
 [ 63%] /data/local/tmp/app-debug.apk
 [ 64%] /data/local/tmp/app-debug.apk
 [ 64%] /data/local/tmp/app-debug.apk
 [ 64%] /data/local/tmp/app-debug.apk
 [ 64%] /data/local/tmp/app-debug.apk
 [ 65%] /data/local/tmp/app-debug.apk
 [ 65%] /data/local/tmp/app-debug.apk
 [ 65%] /data/local/tmp/app-debug.apk
 [ 66%] /data/local/tmp/app-debug.apk
 [ 66%] /data/local/tmp/app-debug.apk
 [ 66%] /data/local/tmp/app-debug.apk
 [ 66%] /data/local/tmp/app-debug.apk
 [ 67%] /data/local/tmp/app-debug.apk
 [ 67%] /data/local/tmp/app-debug.apk
 [ 67%] /data/local/tmp/app-debug.apk
 [ 68%] /data/local/tmp/app-debug.apk
 [ 68%] /data/local/tmp/app-debug.apk
 [ 68%] /data/local/tmp/app-debug.apk
 [ 68%] /data/local/tmp/app-debug.apk
 [ 69%] /data/local/tmp/app-debug.apk
 [ 69%] /data/local/tmp/app-debug.apk
 [ 69%] /data/local/tmp/app-debug.apk
 [ 69%] /data/local/tmp/app-debug.apk
 [ 70%] /data/local/tmp/app-debug.apk
 [ 70%] /data/local/tmp/app-debug.apk
 [ 70%] /data/local/tmp/app-debug.apk
 [ 71%] /data/local/tmp/app-debug.apk
 [ 71%] /data/local/tmp/app-debug.apk
 [ 71%] /data/local/tmp/app-debug.apk
 [ 71%] /data/local/tmp/app-debug.apk
 [ 72%] /data/local/tmp/app-debug.apk
 [ 72%] /data/local/tmp/app-debug.apk
 [ 72%] /data/local/tmp/app-debug.apk
 [ 73%] /data/local/tmp/app-debug.apk
 [ 73%] /data/local/tmp/app-debug.apk
 [ 73%] /data/local/tmp/app-debug.apk
 [ 73%] /data/local/tmp/app-debug.apk
 [ 74%] /data/local/tmp/app-debug.apk
 [ 74%] /data/local/tmp/app-debug.apk
 [ 74%] /data/local/tmp/app-debug.apk
 [ 74%] /data/local/tmp/app-debug.apk
 [ 75%] /data/local/tmp/app-debug.apk
 [ 75%] /data/local/tmp/app-debug.apk
 [ 75%] /data/local/tmp/app-debug.apk
 [ 76%] /data/local/tmp/app-debug.apk
 [ 76%] /data/local/tmp/app-debug.apk
 [ 76%] /data/local/tmp/app-debug.apk
 [ 76%] /data/local/tmp/app-debug.apk
 [ 77%] /data/local/tmp/app-debug.apk
 [ 77%] /data/local/tmp/app-debug.apk
 [ 77%] /data/local/tmp/app-debug.apk
 [ 78%] /data/local/tmp/app-debug.apk
 [ 78%] /data/local/tmp/app-debug.apk
 [ 78%] /data/local/tmp/app-debug.apk
 [ 78%] /data/local/tmp/app-debug.apk
 [ 79%] /data/local/tmp/app-debug.apk
 [ 79%] /data/local/tmp/app-debug.apk
 [ 79%] /data/local/tmp/app-debug.apk
 [ 79%] /data/local/tmp/app-debug.apk
 [ 80%] /data/local/tmp/app-debug.apk
 [ 80%] /data/local/tmp/app-debug.apk
 [ 80%] /data/local/tmp/app-debug.apk
 [ 81%] /data/local/tmp/app-debug.apk
 [ 81%] /data/local/tmp/app-debug.apk
 [ 81%] /data/local/tmp/app-debug.apk
 [ 81%] /data/local/tmp/app-debug.apk
 [ 82%] /data/local/tmp/app-debug.apk
 [ 82%] /data/local/tmp/app-debug.apk
 [ 82%] /data/local/tmp/app-debug.apk
 [ 83%] /data/local/tmp/app-debug.apk
 [ 83%] /data/local/tmp/app-debug.apk
 [ 83%] /data/local/tmp/app-debug.apk
 [ 83%] /data/local/tmp/app-debug.apk
 [ 84%] /data/local/tmp/app-debug.apk
 [ 84%] /data/local/tmp/app-debug.apk
 [ 84%] /data/local/tmp/app-debug.apk
 [ 84%] /data/local/tmp/app-debug.apk
 [ 85%] /data/local/tmp/app-debug.apk
 [ 85%] /data/local/tmp/app-debug.apk
 [ 85%] /data/local/tmp/app-debug.apk
 [ 86%] /data/local/tmp/app-debug.apk
 [ 86%] /data/local/tmp/app-debug.apk
 [ 86%] /data/local/tmp/app-debug.apk
 [ 86%] /data/local/tmp/app-debug.apk
 [ 87%] /data/local/tmp/app-debug.apk
 [ 87%] /data/local/tmp/app-debug.apk
 [ 87%] /data/local/tmp/app-debug.apk
 [ 88%] /data/local/tmp/app-debug.apk
 [ 88%] /data/local/tmp/app-debug.apk
 [ 88%] /data/local/tmp/app-debug.apk
 [ 88%] /data/local/tmp/app-debug.apk
 [ 89%] /data/local/tmp/app-debug.apk
 [ 89%] /data/local/tmp/app-debug.apk
 [ 89%] /data/local/tmp/app-debug.apk
 [ 89%] /data/local/tmp/app-debug.apk
 [ 90%] /data/local/tmp/app-debug.apk
 [ 90%] /data/local/tmp/app-debug.apk
 [ 90%] /data/local/tmp/app-debug.apk
 [ 91%] /data/local/tmp/app-debug.apk
 [ 91%] /data/local/tmp/app-debug.apk
 [ 91%] /data/local/tmp/app-debug.apk
 [ 91%] /data/local/tmp/app-debug.apk
 [ 92%] /data/local/tmp/app-debug.apk
 [ 92%] /data/local/tmp/app-debug.apk
 [ 92%] /data/local/tmp/app-debug.apk
 [ 93%] /data/local/tmp/app-debug.apk
 [ 93%] /data/local/tmp/app-debug.apk
 [ 93%] /data/local/tmp/app-debug.apk
 [ 93%] /data/local/tmp/app-debug.apk
 [ 94%] /data/local/tmp/app-debug.apk
 [ 94%] /data/local/tmp/app-debug.apk
 [ 94%] /data/local/tmp/app-debug.apk
 [ 94%] /data/local/tmp/app-debug.apk
 [ 95%] /data/local/tmp/app-debug.apk
 [ 95%] /data/local/tmp/app-debug.apk
 [ 95%] /data/local/tmp/app-debug.apk
 [ 96%] /data/local/tmp/app-debug.apk
 [ 96%] /data/local/tmp/app-debug.apk
 [ 96%] /data/local/tmp/app-debug.apk
 [ 96%] /data/local/tmp/app-debug.apk
 [ 97%] /data/local/tmp/app-debug.apk
 [ 97%] /data/local/tmp/app-debug.apk
 [ 97%] /data/local/tmp/app-debug.apk
 [ 98%] /data/local/tmp/app-debug.apk
 [ 98%] /data/local/tmp/app-debug.apk
 [ 98%] /data/local/tmp/app-debug.apk
 [ 98%] /data/local/tmp/app-debug.apk
 [ 99%] /data/local/tmp/app-debug.apk
 [ 99%] /data/local/tmp/app-debug.apk
 [ 99%] /data/local/tmp/app-debug.apk
 [ 99%] /data/local/tmp/app-debug.apk
 [100%] /data/local/tmp/app-debug.apk
 /Users/kristianfallro/Projects/embark-native/android/app/build/outputs/apk/debug/app-debug.apk: 1 file pushed. 202.9 MB/s (23602984 bytes in 0.111s)
 : stdoupkg: /data/local/tmp/app-debug.apk
 Successt:
 : stdout:
 : /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell getprop ro.build.version.sdk
 21stdout:
 : stdout:
10: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554 install -rg /Users/kristianfallro/Projects/e bark-native/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk
 [  2%] /data/local/tmp/app-debug-androidTest.apk
 [  4%] /data/local/tmp/app-debug-androidTest.apk
 [  6%] /data/local/tmp/app-debug-androidTest.apk
 [  8%] /data/local/tmp/app-debug-androidTest.apk
 [ 10%] /data/local/tmp/app-debug-androidTest.apk
 [ 12%] /data/local/tmp/app-debug-androidTest.apk
 [ 14%] /data/local/tmp/app-debug-androidTest.apk
 [ 16%] /data/local/tmp/app-debug-androidTest.apk
 [ 19%] /data/local/tmp/app-debug-androidTest.apk
 [ 21%] /data/local/tmp/app-debug-androidTest.apk
 [ 23%] /data/local/tmp/app-debug-androidTest.apk
 [ 25%] /data/local/tmp/app-debug-androidTest.apk
 [ 27%] /data/local/tmp/app-debug-androidTest.apk
 [ 29%] /data/local/tmp/app-debug-androidTest.apk
 [ 31%] /data/local/tmp/app-debug-androidTest.apk
 [ 33%] /data/local/tmp/app-debug-androidTest.apk
 [ 35%] /data/local/tmp/app-debug-androidTest.apk
 [ 38%] /data/local/tmp/app-debug-androidTest.apk
 [ 40%] /data/local/tmp/app-debug-androidTest.apk
 [ 42%] /data/local/tmp/app-debug-androidTest.apk
 [ 44%] /data/local/tmp/app-debug-androidTest.apk
 [ 46%] /data/local/tmp/app-debug-androidTest.apk
 [ 48%] /data/local/tmp/app-debug-androidTest.apk
 [ 50%] /data/local/tmp/app-debug-androidTest.apk
 [ 52%] /data/local/tmp/app-debug-androidTest.apk
 [ 54%] /data/local/tmp/app-debug-androidTest.apk
 [ 57%] /data/local/tmp/app-debug-androidTest.apk
 [ 59%] /data/local/tmp/app-debug-androidTest.apk
 [ 61%] /data/local/tmp/app-debug-androidTest.apk
 [ 63%] /data/local/tmp/app-debug-androidTest.apk
 [ 65%] /data/local/tmp/app-debug-androidTest.apk
 [ 67%] /data/local/tmp/app-debug-androidTest.apk
 [ 69%] /data/local/tmp/app-debug-androidTest.apk
 [ 71%] /data/local/tmp/app-debug-androidTest.apk
 [ 73%] /data/local/tmp/app-debug-androidTest.apk
 [ 76%] /data/local/tmp/app-debug-androidTest.apk
 [ 78%] /data/local/tmp/app-debug-androidTest.apk
 [ 80%] /data/local/tmp/app-debug-androidTest.apk
 [ 82%] /data/local/tmp/app-debug-androidTest.apk
 [ 84%] /data/local/tmp/app-debug-androidTest.apk
 [ 86%] /data/local/tmp/app-debug-androidTest.apk
 [ 88%] /data/local/tmp/app-debug-androidTest.apk
 [ 90%] /data/local/tmp/app-debug-androidTest.apk
 [ 92%] /data/local/tmp/app-debug-androidTest.apk
 [ 95%] /data/local/tmp/app-debug-androidTest.apk
 [ 97%] /data/local/tmp/app-debug-androidTest.apk
 [ 99%] /data/local/tmp/app-debug-androidTest.apk
 [100%] /data/local/tmp/app-debug-androidTest.apk
 /Users/kristianfallro/Projects/embark-native/android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk: 1 file pushed. 212.3 MB/s (3100977 bytes in 0.014s)
 0: stdopkg: /data/local/tmp/app-debug-androidTest.apk
 Successut:
 0: stdout:
 1: /Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell am force-stop com.isea.Embark
/Users/kristianfallro/android-sdk-macosx/platform-tools/adb -s emulator-5554 shell am instrument -w -r -e detoxServer ws://localhost:54991 -e detoxSessionId a11f7ce0-f72f-bc41-3072-996ca27b2422 -e debug false com.isea.Embark.test/android.support.test runner.AndroidJUnitRunner
 8691umentation spawned, childProcess.pid: 
 send: {"type":"isReady","params":{},"messageId":-1000}
 INSTRUMENTATION_STATUS: numtests=1
 INSTRUMENTATION_STATUS: stream=
 com.isea.Embark.DetoxTest:
 INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
 INSTRUMENTATION_STATUS: test=runDetoxTests
 INSTRUMENTATION_STATUS: class=com.isea.Embark.DetoxTest
 INSTRUMENTATION_STATUS: current=1
 INSTRUMENTATION_STATUS_CODE: 1
 nstrumentation stdout: 
 onMessage: {"type":"ready","params":{},"messageId":-1000}
  rbx
 send: {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.Detox"},"method":"launchMainActivity","args":[]},"messageId":1}
 onMessage: {"type":"invokeResult","params":{"result":"(null)"},"messageId":1}
  rbx
 send: {"type":"isReady","params":{},"messageId":-1000}
 onMessage: {"type":"ready","params":{},"messageId":-1000}
  rbx
 send: {"type":"invoke","params":{"target":{"type":"Class","value":"com.wix.detox.Detox"},"method":"startActivityFromUrl","args":[{"type":"String","value":"ioletsembark://login/token/<REDACTED> 0c"}]},"messageId":2}
 onMessage: {"type":"error","params":{"error":"Could not launch intent Intent { act=android.intent.action.VIEW dat=ioletsembark://login/token/<REDACTED> flg=0x10000000 cmp=com.isea.Embark/.MainActivity } within 45 seconds. Perhaps the main thread has not gone idle within a reasonable amount of time? There could be an animation or something constantly repainting the screen. Or the activity is doing network calls on creation? See the threaddump logs. For your reference the last time the event queue was idle before your activity launch request was 1523458422083 and now the last time the queue went idle was: 1523458467520. If these numbers are the same your activity might be hogging the event queue."},"messageId":2}
@aaronpankratz
Copy link

aaronpankratz commented May 24, 2018

I ended up using a custom ActivityTestRule class to get around this. The key was launching activities in a separate thread.

package com.*;

import android.app.Activity;
import android.content.Intent;
import android.support.annotation.Nullable;
import android.support.test.rule.ActivityTestRule;

public class CustomActivityTestRule<T> extends ActivityTestRule {
    public CustomActivityTestRule(Class<T> activityClass) {
        super(activityClass, false, false);
    }

    private void superLaunchActivity(Intent startIntent) {
        super.launchActivity(startIntent);
    }

    @Override
    public Activity launchActivity(@Nullable final Intent startIntent) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                superLaunchActivity(startIntent);
            }
        }).start();
        return null;
    }
}

@stale
Copy link

stale bot commented Jul 8, 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 stale bot added the 🏚 stale label Jul 8, 2018
@kristfal
Copy link
Author

kristfal commented Jul 9, 2018

This issue is not stale.

@rotemmiz
Copy link
Member

rotemmiz commented Jul 9, 2018

Using a different thread solved it, that's interesting. Do you get an ANR from your app while Detox is running ?
If so, can you post that ANR here ?

@stale
Copy link

stale bot commented Aug 23, 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 stale bot added the 🏚 stale label Aug 23, 2018
@kristfal
Copy link
Author

This issue is not stale

@stale
Copy link

stale bot commented Oct 7, 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 stale bot added the 🏚 stale label Oct 7, 2018
@stale
Copy link

stale bot commented Oct 14, 2018

The issue has been closed for inactivity.

@stale stale bot closed this as completed Oct 14, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 17, 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

4 participants