1

When I try to run my application from the IDE on an x86 emulator I get an error "Application Installation Failed" with the message

Failed to finalize session: INSTALL_FAILED_TEST_ONLY: installackageLI

As I understand this error is because Android Studio automatically adds the android:testOnly="true" manifest attribute on all debug builds which requires adb install to use the -t flag to install the apk. This flag should not however be required when running from the IDE itself.

If I add the -t flag in Install Flags in my build configuration the apk can be installed, though only if Instant Run is disabled (and only if I do a clean build if it was previously enabled). Re-enabling Instant Run produces the same error even when including the -t flag.

UPDATE:

The above occurs only when using android gradle plugin version 3.0.0.

When I revert to version 2.3.0 the problem disappears.

UPDATE 2:

This is related to IntelliJ IDE.

Android Studio 3.0 works fine with my configuration.

See the answers in this post.

kliron
  • 4,383
  • 4
  • 31
  • 47
  • How exactly are you trying to install this APK? Running the app directly from the IDE (e.g., triangle Run button in toolbar) should work without issue. The `-t` is for manual installations of an APK generated by Run. – CommonsWare Dec 01 '17 at 11:49
  • I am running it from the IDE as you describe. It only installs if I add the `-t` and disable instant run as I wrote above. – kliron Dec 01 '17 at 12:00
  • Instant Run works for thousands upon thousands of developers, without having to manually adjust things... in Android Studio. I have no idea what the situation is with stock IntelliJ IDEA. – CommonsWare Dec 01 '17 at 12:04
  • I don't think there is an Android Plugin for Gradle 3.3.0. Leastways, it does not exist [on Google's Maven repository](https://dl.google.com/dl/android/maven2/index.html), nor does it work if I try to define `classpath 'com.android.tools.build:gradle:3.3.0'` in a project's top-level `build.gradle` file. – CommonsWare Dec 01 '17 at 12:35
  • Your edit to your question cites `3.3.0`, not `3.0.0`. Countless developers are using Instant Run with Gradle 4.1 and Android Plugin for Gradle 3.0.0 (or 3.0.1) on Android Studio. – CommonsWare Dec 01 '17 at 12:54
  • Thanks, fixed the edit. Countless developers may do so but not me. I wouldn't be posting here otherwise. – kliron Dec 01 '17 at 12:56
  • My point is that there must be something else different about your environment than what others are using. – CommonsWare Dec 01 '17 at 13:09
  • Ok, so at least one other person is having the same issue... https://stackoverflow.com/questions/46634835/cant-use-beta-android-gradle-plugin-3-0-0-with-intellij-idea – kliron Dec 01 '17 at 16:30

0 Answers0