7

I am trying to run Detox test on the emulator. When I run "detox test --configuration android.emu.debug -l verbose" it throwing error message as

"No instrumentation runner found on device emulator-5556 for package my.project.android.debug

at ADB.getInstrumentationRunner (../node_modules/detox/src/devices/android/ADB.js:219:54)"

Note : apk is getting install in the emulator but it is not launching the app.

Version details :

  • Detox : v8.0.0
  • node : v8.11.3
  • npm : 5.6.0
  • react-native-cli: 2.0.1
  • react-native: 0.53.3

Just to update more,

When I run adb shell pm list instrumentation I could not find my app instrumentation. However, the application is already installed in the emulator.

Neerajkumar
  • 300
  • 4
  • 19

3 Answers3

1

After you build your Android app you'll be able to find it in the next path: android/app/build/outputs/apk/debug/app-debug.apk

Also, when the app is built you'll be able to find a folder androidTest in the next path: android/app/build/outputs/apk/androidTest/debug/app-debug-androidTest.apk. You should install that file on the device and after that you'll be able to run the test.

user16217248
  • 3,119
  • 19
  • 19
  • 37
0

The reason for this error is that you are testing apk or .app that is not build using detox build command. you can only test the apk or .app file those are build using detox build command

so before detox test you need to run detox build -c {configuration name} then for android configuration 2 files are generated one is test (testBinaryPath) and one is actual (binaryPath). for iOS configuration 1 file .app (binaryPath) is generated

then you need to fire detox test command for that configuration then it will work

detox test -c configuration name

  'android.release': {
      type: 'android.apk',
      binaryPath: 'android/app/release/app-release.apk',
      testBinaryPath: 'android/app/androidTest/release/app-release-androidTest.apk',
      build: 'cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release'
    }

    'ios.release': {
      binaryPath: "-destination/Build/Products/Release-iphonesimulator/MyRNDemoApp.app",
      build: "xcodebuild -workspace ios/MyRNDemoApp.xcworkspace -configuration Release -scheme MyRNDemoApp -sdk iphonesimulator -derivedDataPath ios/build -destination id=43EC5255-C8A8-473B-8E9E-A2CF4117B611",
      type: 'ios.app',
    },
Rajesh N
  • 6,198
  • 2
  • 47
  • 58
-3

Appreciating that this is a rather old question. However I was having this same error while trying to run Detox test locally and it took me a while to figure out a solution for me - Googling this error doesn't bring up much help.

Anyway, this is how I resolved this particular error..

Change this code in the e2e/init.js file: (as set up by the detox init command)

beforeAll(async () => {
  await detox.init(config, { reuse: true })
})

to this...

beforeAll(async () => {
  await detox.init(config)
})

This for me resolved the issue of

Error: No instrumentation runner found on device emulator-5554 for package com.

Stuart
  • 1,544
  • 5
  • 29
  • 45