简体   繁体   中英

How to resolve Execution failed for task ':app:mergeDebugResources'. in android studio 3.6.2

i'm completely new to android studio. I created my 1st project and set up emulator but when i run the application i got the error below and the build output: build failed. please help me out, thanks

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:mergeDebugResources'.

    Could not resolve all files for configuration ':app:_internal_aapt2_binary'. Could not resolve com.android.tools.build:aapt2:3.6.2-6040484. Required by: project:app No cached version of com.android.tools.build:aapt2:3.6.2-6040484 available for offline mode. No cached version of com.android.tools.build:aapt2:3.6.2-6040484 available for offline mode.

Hello (found a solution), After a lot of research and a lot of tests. I finally found the answer to the error I got (exactly the same as yours) ^^. It probably happened when I updated Android Studio..: Anyway here's what I did and it worked, Open any project. and do "FILE" > "PROJECT STRUCTURE..." (or the shortcut Ctrl+Alt+Shift+S). Go to the project section (at the very top) of the window that just appeared and choose the latest version of Android Gradle Puglin (= Android Studio version) and Gradle (now it's 3.6.2 for AS and 6.3 for Gradle): Once done. "APPLY" & "OK".

Second thing to do: "VIEW" > "TOOL WINDOWS" > "GRADLE". With the window that just opened, click on "TOGGLE OFFLINE MODE", the penultimate icon at the top of the window (it MUST NOT be highlighted anymore), and keep this window for a little while. Now build your project/create the apk file to run Gradle and download the necessary, since you have changed version (Connect your pc to the internet.), Normally (at least for me). AS will download what you need and you'll just have to wait a bit,As soon as the build is finished (which is already good news ^^). go back to the Gradle window and reactivate "TOGGLE OFFLINE MODE" (it MUST be highlighted), Rebuild your project to make sure it works (I don't know if this step is necessary, but better too much than too little!), and you're done! No more errors and no more need to connect to the Internet!

I hope this has been useful;)

These resources need to be installed and it can't be synced offline so you need to connect to internet and then sync build.gradle again in order to download these resources. Hope this will help you.

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