Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

gradle - Error - Android resource linking failed (AAPT2 27.0.3 Daemon #0)

I have this error

I am try reinstall android studio and remove .gradle folder , any solution please?

    Error:FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed (AAPT2 27.0.3 Daemon #0)
  Command: C:javasdkuild-tools27.0.3aapt2.exe link -I
          C:javasdkplatformsandroid-26android.jar
          --manifest



  C:UsersJalal D.gradlecachesransforms-1files-1.1fonticon-0.1.8.aar2b09376fc14469ba65fc8e4d85c2eed1
esvaluesvalues.xml:19:5-25:25: AAPT: error: resource android:attr/fontVariationSettings not found.

  C:UsersJalal D.gradlecachesransforms-1files-1.1fonticon-0.1.8.aar2b09376fc14469ba65fc8e4d85c2eed1
esvaluesvalues.xml:19:5-25:25: AAPT: error: resource android:attr/ttcIndex not found.

  error: failed linking references.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 3s
Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Android resource linking failed error can also appear if you have an error in any of your XML resources. In my case I was using the following line twice in one of my XML drawables in drawable folder:

<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>

I removed the duplicate line and the error disappeared. The error was a bit misleading:

Android resource linking failed Output: /Users/johndoe/Desktop/myapp/app/src/main/res/layout/activity_main.xml:2: error: resource drawable/bg_main (aka com.example.myproject:drawable/bg_main) not found.

According to the above error, the first thing you need to do is to proof read all the drawable resources that are accessed in the activity_main because the chances are higher that you will find the error. In the worst case scenario you might end up checking all your resource files.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...