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

纵饮孤独 提交于 2019-12-18 10:46:22

问题


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


回答1:


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




回答2:


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)

  2. Gradle build + clean (app level)

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

  4. Clean Project

    Navigate to Build > Clean Project

And it should work now!

  • Solution 2: disable instant run (as stated by Teresa)



回答3:


I had same error in Redmi Note 3.

For Xiaomi devices,Go to Developer options and turn off MIUI optimization. After device is rebooted it will work.

See: http://en.miui.com/thread-255506-1-1.html




回答4:


Just hit Tab Build> Clean Project in android studio. You are good to go.




回答5:


Check if multiple activities have set to <category android:name="android.intent.category.LAUNCHER" />




回答6:


Disabling Instant run worked for me just go to settings and search for instant run just disable apply changes rerun the app it will install correctly.

it should work




回答7:


After looking at Ginggas answer I found this solution that worked for me:

  1. Clicking on Build and then Clean Project.
  2. Clicking on Build and then on Rebuild Project

After that it worked like a charm again :)




回答8:


For me just Build -> Clean Project worked. I had to uninstall the app on the test device.

Here is the option to clean project.




回答9:


I am using mac and could not find Instant Run option in that. I tried doing invalidate cache and restart and it worked.




回答10:


For those using mac, do Build apk(s) from build menu. And install apk through adb install -r /app/build/outputs/apk/debug/app-debug.apk




回答11:


I was also facing the slice-apk issue and it worked after Invalidate Cache / Restart command under Android Studio File menu. Disabling Instant Run is not required.




回答12:


THIS IS THE SOLUTION:

getting rid of the instant run is a terrible "solution". To get things working again for me, I upgraded my grade to 5.4.

Just go to

File >> project structure >> Gradle version 

You should be able to edit it to be the most up to date version. Hope this helps.



来源:https://stackoverflow.com/questions/42672157/how-to-stop-installation-of-multiple-slice-apk-in-android-studio-2-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!