Android unable to launch app after successful build
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
I am facing the same issue, Any updates?
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