AAPT: error: failed writing to R.txt Android resources linking failed ':app:processDebugResources' Android Studio 4.0.1 (Aug 2020)

Gradle Build Failed at ':app:processDebugResources'

reviously, we talked about this version of Android Studio has an issue of Launcher Activity (See here). Now we got another issue about Android Studio 4.0.1, which is Gradle Build Process failed at ':app:processDebugResources'

This issue will produce log like:

AGPBI: {“kind”:”error”,”text”:”Android resources linking failed” …..

AAPT: Error: failed writing to ‘…\app\build\intermediates\runtim_symbol_list\debug\R.txt’: …

Error log

The cause of this issue is all about the combination of Android Gradle Plugin Version and Gradle Version.

The problematic combination I experience is

Android Gradle Plugin Version:4.0.1

Gradle Version: 6.1.1

Problematic combination of Android Gradle Plugin Version and Gradle Version

To workaround this problem, we have to lower Android Gradle Tool version and Gradle Version.

I tested below combination that works.

Combination:

Android Gradle Plugin Version: 3.6.1

Gradle Version: 6.0

Android Gradle Plugin Version: 3.6.1, Gradle Version: 6.0

To change this setting:

  1. Select File>Project Structure.
  2. Type in (3.6.3) the Android Gradle Plugin Version.
  3. Type/select (6.0) from dropdown menu the Gradle Version.
  4. Hit OK to Save.

That’s it.

Happy coding.

Let me know if you find better solution or approach in the comment section below. ;)

Find me at Twitter @rick3817

--

--

Hi this is Rick from Hong Kong. I am a native iOS and Android mobile developer and also a tech enthusiast. Find me on Twitter https://twitter.com/rick3817

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rick_HK

Hi this is Rick from Hong Kong. I am a native iOS and Android mobile developer and also a tech enthusiast. Find me on Twitter https://twitter.com/rick3817