Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Stop Installation of Multiple Slice APK In Android Studio 2.3

Tags:

java

android

apk

After updating the android studio to version 2.3. i am facing issue during installation on android device from android studio. here attaching the output raised in console before and after updating the android studio.

Before updated to android studio 2.3

$ adb push E:\mynewapp\TestDemo\TestDemo\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.gangsofcoder.testdemo
$ adb shell pm install -r "/data/local/tmp/com.example.gangsofcoder.testdemo"
    pkg: /data/local/tmp/com.example.gangsofcoder.testdemo
Success

After updated to android studio 2.3

$ adb install-multiple -r E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\dep\dependencies.apk
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_1.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_3.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_0.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_2.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_4.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_6.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_5.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_7.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_8.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\intermediates\split-apk\debug\slices\slice_9.apk 
 E:\SurajBahadur\testdemoApp\testdemo\app\build\outputs\apk\app-debug.apk 

Error while Installing APKs

This is prompt getting during installation

like image 739
Suraj Bahadur Avatar asked Mar 08 '17 13:03

Suraj Bahadur


People also ask

Why Reduce APK size?

A large APK can take up most of a user's Network/Wifi Bandwidth and, most importantly, it could occupy most of the space on his mobile device. Reduce apk size android. Your APK's size can have an impact on the speed of your app loading, how much memory it uses and how much power you use. Reduce apk size android.

When building mobile apps which image codec should be used for an optimized APK?

Use images in WebP file format WebP is another one of the famous image formats which are developed by Google. This image format generally focuses on image quality and optimization. Rather than using images in PNG and JPEG format WebP image format is highly preferable because of its quality.


2 Answers

This is caused by "instant run" feature in studio 2.3, you can disable it by:

Open the Settings or Preferences dialog. Navigate to Build, Execution, Deployment > Instant Run. Uncheck the box next to Enable Instant Run.

More info, please check: https://developer.android.com/studio/run/index.html

like image 186
Teresa Avatar answered Oct 16 '22 07:10

Teresa


Here's my solution (there's no need to deactivate instant run) Do all these steps in the stated order:

  1. Gradle Build (root level)

    Gradle Build

  2. Gradle build + clean (app level)

    Gradle Build App Level

  3. Choose app on the top bar (left of run 'app')

    Gradle Build App Level

  4. Clean Project

    Navigate to Build > Clean Project

And it should work now!

  • Solution 2: disable instant run (as stated by Teresa)
like image 14
Ginggas Avatar answered Oct 16 '22 07:10

Ginggas