简体   繁体   English

android studio 2.3即时运行不起作用

[英]android studio 2.3 instant run not working

I have updated android studio from 2.2 to 2.3,then I found Instant run not working. 我已经将android studio从2.2更新到2.3,然后我发现Instant run无法运行。

Error while executing: am startservice com.example.codingmaster.testcc/com.android.tools.fd.runtime.InstantRunService Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.codingmaster.testcc/com.android.tools.fd.runtime.InstantRunService } Error: Not found; 执行时出错:am startservice com.example.codingmaster.testcc / com.android.tools.fd.runtime.InstantRunService启动服务:Intent {act = android.intent.action.MAIN cat = [android.intent.category.LAUNCHER] cmp = com.example.codingmaster.testcc / com.android.tools.fd.runtime.InstantRunService}错误:未找到; no service started. 没有服务开始。

I also try reinstall android studio 2.3 but not work. 我也尝试重新安装android studio 2.3但不行。

In case you are running a device with MIUI, go to Developer Settings > Turn on MIUI optimization and turn it off. 如果您正在运行具有MIUI的设备,请转到开发人员设置>打开MIUI优化并将其关闭。

You will then need to restart your device and recompile the code. 然后,您需要重新启动设备并重新编译代码。

Instant Run should then work again 然后,Instant Run应该再次运行

Found a solution. 找到了解决方案。 You have to enable auto-start support for other device manufacturers (example ASUS, LeEco and some others). 您必须为其他设备制造商启用自动启动支持(例如ASUS,LeEco和其他一些设备)。

For LeEco - 对于LeEco -

  1. Install the app with Instant Run. 使用Instant Run安装应用程序。 It should fail (If it doesn't, why are you reading this in the first place?) 它应该失败(如果没有,你为什么一开始就读这个?)

  2. Go to Settings . 转到“设置”

  3. Look for Permissions under Personal . Personal下查找权限

  4. Choose "You have allowed X apps to autolaunch". 选择“您已允许X应用自动启动”。 Toggle <Your app name> ON . 切换<Your app name> 开启

  5. Done! 完成! Instant Run works. 即时运行。

For ASUS, give that app Auto-Start permission with Auto Start Manager. 对于华硕,请使用Auto Start Manager为该应用程序提供自动启动权限。 See here for more information. 有关更多信息,请参见此处

For other devices, please find some similar setting. 对于其他设备,请找一些类似的设置。

EDIT - 编辑 -

If you have disabled auto-start in the Purify (or other similar app), please re-enable it. 如果您在Purify(或其他类似应用)中禁用了自动启动功能,请重新启用它。

Source - https://code.google.com/p/android/issues/detail?id=235879 来源 - https://code.google.com/p/android/issues/detail?id=235879

I was facing to the same issue too with an Asus phone. 华硕手机也面临同样的问题。

Error while executing: am startservice com.eyelights.android/com.android.tools.fd.runtime.InstantRunService
Starting service: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.myapp.android/com.android.tools.fd.runtime.InstantRunService }
Error: Not found; no service started.

Thanks to this post, i was able to start my app again : 感谢这篇文章,我能够再次启动我的应用程序:

https://code.google.com/p/android/issues/detail?id=235879 https://code.google.com/p/android/issues/detail?id=235879

Go in Android Studio Preferences : 进入Android Studio首选项:

在此输入图像描述

Disable Instant Run like this : 禁用即时运行,如下所示:

在此输入图像描述

Now you can run your app again. 现在,您可以再次运行您的应用。 Don't forget to enable again Instant run when you switch phone. 切换手机时别忘了再次启用Instant run。

It's not the perfect solution, but it's working 这不是完美的解决方案,但它正在发挥作用

$ adb shell am start -n "com.myapp.android/com.myapp.android.activity.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 16367 on device asus-asus_z00ed-F9AZCY208273

点击这个


from 2.3 There is new icon. 从2.3有新的图标。

see this. 看到这个。

如果您使用的是华硕Zenfone,请确保自动启动管理器不会阻止您的应用运行。

  • Goto File-settings, "Build, Execution, Deployment" 转到文件设置,“构建,执行,部署”
  • click on instantRun 点击instantRun
  • Uncheck Enable instant run Checkbox 取消选中启用即时运行复选框
  • then apply and ok will solve your problem 然后申请,确定将解决您的问题

disable instant run. 禁用即时运行。 This bug in issue tracker: https://code.google.com/p/android/issues/detail?id=235879 问题跟踪器中的此错误: https//code.google.com/p/android/issues/detail? id = 235879

Instant Run Documentation : 即时运行文档

To start using Instant Run, you also need to change the build variant to a debug version of your app and deploy it to a target device running Android 5.0 (API level 21) or higher. 要开始使用Instant Run,您还需要将构建变体更改为应用程序的调试版本,并将其部署到运行Android 5.0(API级别21)或更高版本的目标设备。 To learn about more techniques that speed up your build, read Optimize Your Build Speed 要了解更多加速构建的技术,请阅读优化构建速度

so make sure your build variant is set to 'debug'. 因此,请确保您的构建变体设置为“debug”。

如果您正在使用Genymotion和ARM Translation,则需要在没有安装的情况下创建新图像,并且Instant Run将正常工作。

You need to update your gradle first then after instant run work.. 您需要在即时运行后首先更新您的gradle。

To take advantage of all the latest features (such as Instant Run), improvements and security fixes, we strongly recommend that you update the Android Gradle plugin to version 2.3.0 and Gradle to version 3.3. 要利用所有最新功能(例如即时运行),改进和安全修复程序,我们强烈建议您将Android Gradle插件更新到版本2.3.0并将Gradle更新到版本3.3。

Thanks 谢谢

I had same problem by using Android Studio 2.3.2 and solved the issue by adding these codes in gradle file. 我使用Android Studio 2.3.2遇到了同样的问题,并通过在gradle文件中添加这些代码解决了这个问题。

defaultConfig {
    ...
    minSdkVersion 15
    targetSdkVersion 25
    ...

    // Enabling multidex support.
    multiDexEnabled true
}

 dependencies {
     compile 'com.android.support:multidex:1.0.0'
 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM