square / spoon

Distributing instrumentation tests to all your Androids.
https://square.github.io/spoon/
Apache License 2.0
2.7k stars 476 forks source link

INSTALL_FAILED_TEST_ONLY: installPackageLI #493

Open sarmadali20 opened 7 years ago

sarmadali20 commented 7 years ago

keep getting below exception com.android.ddmlib.InstallException: INSTALL_FAILED_TEST_ONLY: installPackageLI

using spoon-runner-2.0.0-20171020.002642-36

command used: java -jar spoon-runner.jar $TEST_APK $OTHER_APK

bholota commented 7 years ago

Prolly it's related to Android Studio 3.0 - it sets android:testOnly="true" by default. Could you validate that?

sarmadali20 commented 6 years ago

yes setting android:testOnly="false" for debug manifest works

spartanglady commented 6 years ago

I'm Facing the same issue. I'm using spoon runner 1.7.1 jar file. It was working fine for me and it stopped working all of a sudden. I have not made any upgrades to the sdk or to the environment. Is there any other way to debug whats going ?

josefadamcik commented 5 years ago

For all having this issue: it's possible you are trying to use APKs built by Android Studio when using the "run as" feature (running tests or app from Android studio). Such APKs are buit with the "testOnly" flag.

Try to rebuild your apks with gradle ./gradlew assembleDebug assembleAndroidTest(or similar)

paolomoschini commented 5 years ago

From https://developer.android.com/studio/run/index.html

Note: The Run button builds an APK with testOnly="true", which means the APK can only be installed via adb (which Android Studio uses). If you want a debuggable APK that people can install without adb, select your debug variant and click Build Bundle(s) / APK(s) > Build APK(s).

Just go to Build > Build APK(s) to have a non testable release apk that you can submit :)

Tested on Android Studio 3.5