Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing split apks: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_INVALID_APK

Android Studio is not pushing my APK into a physical Nexus 5X with Marshmallow (6.0.1).

This is the output and the error:

01/15 01:51:48: Launching mobile
$ adb install-multiple -r /Users/MyUser/AndroidStudioProjects/MyApp/mobile/build/outputs/apk/mobile-development-debug-unaligned.apk /Users/MyUser/AndroidStudioProjects/MyApp/mobile/build/intermediates/split-apk/development/debug/main.apk /Users/MyUser/AndroidStudioProjects/MyApp/mobile/build/intermediates/split-apk/development/debug/main.apk 

Error installing split apks: com.android.ddmlib.InstallException: Failed to finalize session : INSTALL_FAILED_INVALID_APK: Split lib_main was defined multiple times
Error during launch

Details:

defaultConfig: minSdkVersion 9 targetSdkVersion 23 multiDexEnabled true

2 buildTypes: debug and release

2 productFlavors: development and production

dexOptions: incremental false preDexLibraries = false jumboMode = true javaMaxHeapSize "4096M"

I'm using the latest Android Studio 2.0 Preview 5 (http://tools.android.com/recent/androidstudio20preview5available).

Gradle: distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip

And the build tools are: 'com.android.tools.build:gradle:2.0.0-alpha5'.

Is there a way to tell Android Studio no to use install-multiple to install the apk?

UPDATE (01/15/2016 2:26 AM EST):

The issue doesn't happen when running the app on a Galaxy Nexus emulator with Jelly Bean (4.3.1) nor a physical Samsung Galaxy S with Gingerbread (2.3.6).

UPDATE (01/15/2016 11:30 AM EST):

Ran the app on a Nexus 5 with KitKat (4.4.4) and it works just fine.

like image 902
Oscar Salguero Avatar asked Jan 15 '16 07:01

Oscar Salguero


2 Answers

This should be fixed in in 2.0.0-alpha6, now available. https://sites.google.com/a/android.com/tools/tech-docs/new-build-system

like image 169
Tor Norbye Avatar answered Nov 18 '22 22:11

Tor Norbye


There seem to be multiple issues with the new Gradle Plugins - both with alpha5 and alpha6. But it looks like if all else fails you need to disable Instant Run. For me this particular error was resolved by using alpha6 as @Tor Norbye indicated above -- but then I had this error instead https://code.google.com/p/android/issues/detail?id=195044

Instant Run will be a pretty cool feature when they work out the kinks!

like image 33
bkurzius Avatar answered Nov 18 '22 21:11

bkurzius