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 unable to launch app after successful build #4450

Open
BlinkVonDoom opened this issue Apr 12, 2024 · 2 comments
Open

Android unable to launch app after successful build #4450

BlinkVonDoom opened this issue Apr 12, 2024 · 2 comments

Comments

@BlinkVonDoom
Copy link

Description

Hi all,

We are setting up android for our RN project, and am trying to solve for an issue where we have multiple Variants / Flavors on the app in our project, and we want to only build one for testing at a time.

Following the setup, the build completes successfully. With apks being pushed to android/app/build/outputs/apk/androidTest/flavor1/debug/app-flavor1-debug-androidTest.apk and android/app/build/outputs/apk/flavor1/debug/app-flavor1-debug.apk

detoxrc.js

apps: {
    'android.debug': {
      type: 'android.apk',
      binaryPath: 'android/app/build/outputs/apk/flavor1/debug/app-flavor1-debug.apk',
      testBinaryPath: 'android/app/build/outputs/apk/androidTest/flavor1/debug/app-flavor1-debug-androidTest.apk',
      build: 'cd android && ./gradlew assembleFlavor1Debug assembleFlavor1DebugAndroidTest -DtestBuildType=debug',
      reversePorts: [8081],
    },

When running the tests we receive

""/Users/user/Library/Android/sdk/platform-tools/adb" -s emulator-19998 shell "ps | grep \"com\.package\.flavor1$\""" failed with error = ChildProcessError: Command failed: "/Users/user/Library/Android/sdk/platform-tools/adb" -s emulator-19998 shell "ps | grep \"com\.package\.flavor1$\""
 `"/Users/user/Library/Android/sdk/platform-tools/adb" -s emulator-19998 shell "ps | grep \"com\.package\.falvor1$\""` (exited with error code 1) (code=1), stdout and stderr:

When running adb shell ps | grep com.package.flavor1 we receive adb: more than one device/emulator

Our first test looks like with the first console log printing, but obviously not the second

  beforeAll(async () => {
    console.log('LAUNCHING APP');
    await device.launchApp({
      newInstance: true,
      permissions: {
        userTracking: 'NO',
        notifications: 'YES',
      },
      launchArgs: { detoxURLBlacklistRegex: 'url1, url2', detoxEnableSynchronization: 0 },
    });

    console.log('APP LAUNCHED');
  });

Any additional trouble shooting would be greatly appreciated.

Thanks!

Your environment

Detox version: 20.20.0
React Native version: 0.71.15
Node version: 21.5.0
Device model: Pixel_6_Pro_API_34
OS: macOS
Test-runner (select one): jest

@DheerajKhush
Copy link

I am facing the same issue, Any updates?

@BlinkVonDoom
Copy link
Author

One thing from my logs that I noticed in my logs is the userID -2 may be something of interest. But have not had time to look into that more deeply.
detoxLogs.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants