Java 如何在 Android Studio 2.3 中停止安装多个切片 APK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/42672157/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How To Stop Installation of Multiple Slice APK In Android Studio 2.3
提问by Suraj Bahadur
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.
将android studio更新到2.3版后。我在从 android studio 安装到 android 设备时遇到了问题。此处附上更新 android studio 之前和之后在控制台中引发的输出。
Before updated to android studio 2.3
更新到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
更新到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
安装 APK 时出错
采纳答案by Teresa
This is caused by "instant run" feature in studio 2.3, you can disable it by:
这是由 Studio 2.3 中的“即时运行”功能引起的,您可以通过以下方式禁用它:
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
更多信息,请查看:https: //developer.android.com/studio/run/index.html
回答by Mukesh M
I had same error in Redmi Note 3.
我在 Redmi Note 3 中遇到了同样的错误。
For Xiaomi devices,Go to Developer options and turn off MIUI optimization. After device is rebooted it will work.
对于小米设备,进入开发者选项,关闭MIUI优化。设备重新启动后,它将工作。
回答by Ginggas
Here's my solution (there's no need to deactivate instant run) Do all these steps in the stated order:
这是我的解决方案(无需停用即时运行)按规定顺序执行所有这些步骤:
Gradle Build (root level)
Gradle build + clean (app level)
Choose app on the top bar (left of run 'app')
Clean Project
Navigate to Build > Clean Project
And it should work now!
它现在应该可以工作了!
- Solution 2: disable instant run (as stated by Teresa)
- 解决方案 2:禁用即时运行(如 Teresa 所述)
回答by Androwed
Just hit TabBuild> Clean Project in android studio. You are good to go.
只需在 android studio 中点击TabBuild> Clean Project。你已准备好出发。
回答by SKP
I am using mac and could not find Instant Run option in that. I tried doing invalidate cache and restart
and it worked.
我正在使用 mac,但在其中找不到 Instant Run 选项。我试着做invalidate cache and restart
,它奏效了。
回答by Naveen Singh
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
对于那些使用 mac 的人,请从构建菜单中构建 apk(s)。并通过 adb install -r /app/build/outputs/apk/debug/app-debug.apk 安装 apk
回答by Santhosh Kumar Sayannagari
Check if multiple activities have set to <category android:name="android.intent.category.LAUNCHER" />
检查多个活动是否已设置为 <category android:name="android.intent.category.LAUNCHER" />
回答by Phil Roggenbuck
回答by Gogikar
For me just Build -> Clean Project worked. I had to uninstall the app on the test device.
对我来说只是 Build -> Clean Project 工作。我不得不在测试设备上卸载该应用程序。
Here is the option to clean project.
这是清理项目的选项。
回答by RamKr
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.
我也遇到了 slice-apk 问题,它在 Android Studio File 菜单下的 Invalidate Cache / Restart 命令之后工作。不需要禁用即时运行。