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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…