Search code examples
android-studioandroid-studio-3.0

How to solve Instant Run on Android Studio Canary 5, 6 and 7


Since I upgraded to Android Studio Canary 5 I have had issues with Instant Run, it gives me the following error when Instant Run is enabled:

Information:Gradle tasks [:app:assembleDebug]
Error:C:\..etc.\app\build\intermediates\instant-run-support\debug\dependencies\AndroidManifest.xml:2 resource string/app_build_version_name (aka com.itbackyard.iels.client:string/app_build_version_name) not found
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:java.lang.RuntimeException: com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: Failed to execute aapt
Error:com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: Failed to execute aapt
Error:com.android.ide.common.process.ProcessException: Failed to execute aapt
Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Information:BUILD FAILED in 1m 29s
Information:8 errors
Information:0 warnings
Information:See complete output in console

My only solution was to disable Instant Run from settings. What I was able to find is this topic without a solution so far.

Any idea if this is still a bug or is there any workaround till it gets fixed?

Here is my version information:

Android Studio 3.0 Canary 5
Build #AI-171.4141229, built on June 28, 2017
JRE: 1.8.0_152-release-884-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Edit I have now updated it to

Android Studio 3.0 Canary 6
Build #AI-171.4163606, built on July 7, 2017
JRE: 1.8.0_152-release-884-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

And updated to Canary 7

Android Studio 3.0 Canary 7
Build #AI-171.4182969, built on July 14, 2017
JRE: 1.8.0_152-release-884-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

Still the same problem.


Solution

  • I solved it this way:

    What I did was create an empty new project in Android Studio 3.0 Canary 7, it does not have this behavior. I compared the new empty project default build.gradle (Module: app) with my existing project that has the mentioned problem.

    Of course, this can differ from case to case, but in my case, I used a variable to update versionName and it worked previously without any issues, but not on Andriod Studio 3. Therefore I corrected the lines, Sync and Rebuild the problem was gone.