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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:18:14  来源:igfitidea点击:

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

javaandroidapk

提问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 时出错

This is prompt getting during installation

这是安装过程中的提示

采纳答案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优化。设备重新启动后,它将工作。

Android Developer options MIUI optimization

Android 开发者选项 MIUI 优化

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

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

回答by Ginggas

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

  1. Gradle 构建(根级别)

    摇篮构建

  2. Gradle 构建 + 清理(应用级别)

    Gradle 构建应用程序级别

  3. 选择顶部栏上的应用程序(运行“应用程序”的左侧)

    Gradle 构建应用程序级别

  4. 清洁工程

    导航到 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 restartand 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

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

在查看了 Ginggas 的答案后,我发现了这个对我有用的解决方案:

  1. Clicking on Buildand then Clean Project.
    Build->Clean Project
  2. Clicking on Buildand then on Rebuild Project
    Build->Rebuild Project
  1. 点击Build然后Clean Project.
    构建->清理项目
  2. 点击Build然后点击Rebuild Project
    构建->重建项目

After that it worked like a charm again :)

之后它再次像魅力一样工作:)

回答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. enter image description here

这是清理项目的选项。 在此处输入图片说明

回答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 命令之后工作。不需要禁用即时运行。