简体   繁体   中英

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.

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; no service started.

I also try reinstall android studio 2.3 but not work.

In case you are running a device with MIUI, go to Developer Settings > Turn on MIUI optimization and turn it off.

You will then need to restart your device and recompile the code.

Instant Run should then work again

Found a solution. You have to enable auto-start support for other device manufacturers (example ASUS, LeEco and some others).

For LeEco -

  1. Install the app with 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 .

  4. Choose "You have allowed X apps to autolaunch". Toggle <Your app name> ON .

  5. Done! Instant Run works.

For ASUS, give that app Auto-Start permission with 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.

Source - 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

Go in Android Studio Preferences :

在此输入图像描述

Disable Instant Run like this :

在此输入图像描述

Now you can run your app again. Don't forget to enable again Instant run when you switch phone.

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.

see this.

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

  • Goto File-settings, "Build, Execution, Deployment"
  • click on 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

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. 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'.

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

You need to update your gradle first then after instant run work..

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.

Thanks

I had same problem by using Android Studio 2.3.2 and solved the issue by adding these codes in gradle file.

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

    // Enabling multidex support.
    multiDexEnabled true
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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