android resource linking failed что делать

[SOLVED] Android resource linking failed Error: failed linking file resources.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

This error sometimes also comes as “Android resource linking failed” is another frequent and vague error in Android Studio. The solution sometimes could be quite boring and painful but I assure you, this error is absolutely nothing serious.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Cause

The error shows up when Gradle encounters an error (Usually a syntax or typo error) in one or more of your XML files.

Most of the XML files are located in the res folder, however, you might still find some outside the res folder. For example, the AndroidManifest.xml located in “/src/main/AndroidManifest.xml”. Here is an example of a layout file that would give the “Error: failed linking file resources” error.

Note the “android:endCollor” attribute.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Solution

The solution to the error is obvious, right? All you have to do is go through each of your XML files to figure out where the error might be. This could sometimes be time-consuming but be rest assured that the error will disappear as soon as you find and fix the problem child (problem XML).

You might be lucky and Android Studio will point you in the exact direction as shown in the screenshot below:

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Other times like when you are using an older version of Android Studio, the error would not be this specific.

Tips to finding the problem XML quickly

If you have a lot of XML files and it would be just too difficult to go through them one after the other, you could use the following tips to make the process easier:

If you enjoyed this post, feel free to share it. If you have any questions, feel free to ask them in the comment box below. 🙂

Источник

Gradle error Android Resource linking Failed

Android resource linking failed Output: H:\AndroidProjects\Codify\app\src\main\res\layout\activity_app_setup.xml:19: error: resource drawable/toolbarbackground (aka com.femindharamshi.spa:drawable/toolbarbackground) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\content_main.xml:20: error: resource drawable/toolbarbackground (aka com.femindharamshi.spa:drawable/toolbarbackground) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\content_main.xml:34: error: resource drawable/menu (aka com.femindharamshi.spa:drawable/menu) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\dialog_layout.xml:9: error: resource drawable/dialog_item (aka com.femindharamshi.spa:drawable/dialog_item) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\dialog_layout.xml:17: error: resource drawable/programmer (aka com.femindharamshi.spa:drawable/programmer) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\dialog_layout.xml:37: error: resource drawable/dialog_item (aka com.femindharamshi.spa:drawable/dialog_item) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\dialog_layout.xml:45: error: resource drawable/youtube (aka com.femindharamshi.spa:drawable/youtube) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\dialog_layout.xml:65: error: resource drawable/dialog_item (aka com.femindharamshi.spa:drawable/dialog_item) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\dialog_layout.xml:73: error: resource drawable/meeting (aka com.femindharamshi.spa:drawable/meeting) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\fragment_code.xml:15: error: resource drawable/tagbackground (aka com.femindharamshi.spa:drawable/tagbackground) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\tag_layout.xml:12: error: resource drawable/tagbackground (aka com.femindharamshi.spa:drawable/tagbackground) not found. H:\AndroidProjects\Codify\app\src\main\res\layout\video_layout.xml:17: error: resource drawable/play (aka com.femindharamshi.spa:drawable/play) not found. H:\AndroidProjects\Codify\app\src\main\res\menu\activity_main_drawer.xml:7: error: resource drawable/download (aka com.femindharamshi.spa:drawable/download) not found. H:\AndroidProjects\Codify\app\src\main\res\menu\activity_main_drawer.xml:15: error: resource drawable/settings (aka com.femindharamshi.spa:drawable/settings) not found. H:\AndroidProjects\Codify\app\src\main\res\menu\activity_main_drawer.xml:19: error: resource drawable/report (aka com.femindharamshi.spa:drawable/report) not found. H:\AndroidProjects\Codify\app\src\main\res\menu\activity_main_drawer.xml:27: error: resource drawable/ic_menu_share (aka com.femindharamshi.spa:drawable/ic_menu_share) not found. error: failed linking file resources.

But i have not editing any xml files that would cause this issue and as you can clearly see in the screen shot, all the files are present which Android Studio tells «not found»

EDIT: I transferred all the files from drawable folder to drawable-v24 folder and it solved the issue. I really cannot understand what caused this issue as everything was working perfectly before and suddenly this problem also it weirdly solved by transferring the files, but before it didnt give a problem if they were in the drawable folder

Источник

Failed linking file resources

This is the java file that is giving the error

The errors that I am getting are as follows

Information:Gradle tasks [clean, :app:assembleDebug] C:\Projects\TimeTable\app\src\main\res\layout\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private. Error:resource android:attr/colorSwitchThumbNormal is private. C:\Projects\TimeTable\app\src\main\res\layout-land\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private. Error:resource android:attr/colorSwitchThumbNormal is private. Error:failed linking file resources. Error:java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details Error:Execution failed for task ‘:app:processDebugResources’. Failed to execute aapt Information:BUILD FAILED in 9s Information:9 errors Information:0 warnings Information:See complete output in console

This is the Activity_main.xml file

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

26 Answers 26

You maybe having this error on your java files because there is one or more XML file with error.

Go through all your XML files and resolve errors, then clean or rebuild project from build menu

Start with your most recent edited XML file

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

If anyone reading this has the same problem, this happened to me recently, and it was due to having the xml header written twice by mistake:

The error I was getting was completely unrelated to this file so it was a tough one to find. Just make sure all your new xml files don’t have some kind of mistake like this (as it doesn’t show up as an error). EDIT It seems like it shows up as an error now, make sure to check your error logs.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

One possible solution I already mentioned in a comment:

I had an issue in XML file that IDE did not highlight. Had to ask my colleague to compile for me and it shown in his IDE. Buggy Android Studio.

But I found a way around that.

If you go to Gradle panel on the right. Select your desired module, eg. app, then under build select assembleDebug it will show you all errors in stdout.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Look at the error you are getting:

C:\Projects\TimeTable\app\src\main\res\layout-land\activity_main.xml Error:error: resource android:attr/colorSwitchThumbNormal is private.

It means that in your activity_main.xml you are referencing the color «android:colorSwitchThumbNormal», but inside the ‘android’ namespace that resource is private. What you probably meant to do is try to reference that color from the support version of this attribute, so without the «android:» prefix.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

It’s Obvious that if you have a big project, it will be a nightmare to check each and every xml file.

Run the following command in android studio terminal and it will give you the filename with the issue

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

This message means there is a syntax error in your XML file. If Logcat cannot pinpoint the error with a friendly log message with the xml file name, try cleaning the project and rebuilding the project. It worked for me.

In the Build tab, you will get a node named Android Issues.

The error message explaining the error with the XML file is under it.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

To be more generic about the answer provided by @P Fuster. There can be error in your xml files.

I encountered the same error and was having error in the drawable where end tag was missing.

I know this question has been answered already, however, I still would like to add to what a lot has posted here for others having a similar but not specific problem.

This error sometimes also comes as “Android resource linking failed”. It is sometimes vague. The solution sometimes could be quite boring and painful but, this error is absolutely nothing serious.

In this case, the error is not Vague because Android Studio pointed to the problem file.

General Cause The error shows up when Gradle encounters an error (Usually a syntax or typo error) in one or more of your XML files.

Most of the XML files are located in the res folder, however, you might still find some outside the res folder. For example, the AndroidManifest.xml located in “/src/main/AndroidManifest.xml”. Here is an example of a layout file that would give the “Error: failed linking file resources” error.

Solution To solve this problem, all you have to do is go through each of your XML files to figure out where the error might be. This could sometimes be time-consuming but be rest assured that the error will disappear as soon as you find and fix the problem XML.

You might be lucky and Android Studio will point you in the exact direction just like the one asked in the question.

Other times like when you are using an older version of Android Studio, the error would not be this specific.

Here are some Tips to finding the problem XML quickly If you have a lot of XML files and it would be just too difficult to go through them one after the other, you could use the following tips to make the process easier:

Undo: Most times, you are already halfway through a project before you experience this issue. Meaning that it was a recent change to one of your XML files that caused the issue. If that is the case, you can try to undo your recent change to the XML files. To undo, simply use the key combination: Ctrl+Z.

Open every XML file: The second method involves simply opening every single XML file in your project (Without scanning). The reason for this is that sometimes, after opening the problem XML file, Android Studio then detects the error and underlines the exact line.

Источник

33 Answers 33

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:

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.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Had exactly the same problem. Solved it by doing the following: Searching for and replacing com.android.support:support-v4:+ with com.android.support:support-v4:27.1.0 in the platform/android directory.

Also I had to add the following code to the platforms/android/app/build.gradle and platforms/android/build.gradle files:

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Double check the platforms/android/build.gradle file.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Note: Android Studio spits out a load of crazy errors like this if you upgrade the support libraries to 28.0.0 and your compileSdkVersion is not 28 also.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

If you are using Windows 10, and Android Studio 3.2, you can simply go to the app’s build.gradle, and change the version.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

In your layout (xml) files almost every element has a property i.e. «id» which, can be assigned in order to refer to it from the java/kotlin code or from the xml itself.

Hence the solution below should be considered:-

I resolved it by adding @+id/ before all my IDs.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

com.android.support:support-v4 just recently got update and maybe affect to plugin that use updated version in their dependencies. But if you cannot find in the dependencies (like if you use crosswalk plugin), just put this code in top of your code gradle plugin (no need to add on build.gradle).

Example location to put the code in crosswalk plugin here

Feel free to edit version of com.android.support (DO NOT USE THE 28.0.0) because thats the problem

I imported new colors to my project and got the same problem. So I opened styles.xml and re-assigned items to colors using new colors names.

There should be some error in resource files. It mean is there may be miss typed value of attributes. Go through the resource files and correct these value and enjoy the work.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

There can be multiple reasons for this problem and these reasons are mainly in the resource or app level build.gradle file.

In my case, a view in the resource file didn’t had the required dependency included in the build.gradle file.

So, make sure to include all the required dependencies in the build.gradle file.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Try update latest build version, target and compile version and also update dependencies but not works for me

In my case change to in manifest works for me.

Hope its helpful for someone.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

I had the same problem, but it was because in my buttons layout_width/height I forgot to put dp at the end when editing them. Added dp and problem fixed :/

For me, the error appeared after changing my launcher icon using Asset Studio. Turns out that the ic_launcher_foreground.xml file that was generated was missing the following line at the top of the file:

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

In my case I accidentally wrote:

Interestingly, Android Studio were able to navigate the string via CTRL+click. It was just giving Build Time error. Changing to standard «dot seperation» did the trick

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Found one of the reasons which causes this problem

When we try to use any

in manifest file that is not present in values (string.xml,style.xml,color.xml,etc,) then this type of error occurs

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

i got the same bug, and i fixed it when i close the AndroidStudio and delete the dir like C:\Users\Jalal D\.gradle\caches\transforms-1\ in the build error info.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

I was having similar problem but I came out of the solution the problem was that you were using any thing in the dependency that correspond to same domain but with different versions make sure those all are same

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

I was facing same issue and it is resolved by removing error from resource files like style, colors files in values folder. In my case, error in style colors as below:

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

Changing the version of the support library of the last one enabled (28.0.0) by the previous (27.1.0), the error Android Resource Linking Failed disappeared.

It should be noted that version 27.1.0 is the maximum allowed in our implementations, which works, but you could use an older one if you wish. And this has to be used in all dependencies that start with the string com.android.support:

project/app/build.gradle

project/build.gradle

Then, Sync Project with Gradle Files

Same issue occurred for me, but before getting this error, my app was running. So I just did undo 2/3 times. And did changes again. And build app.app ran successfully.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

I’ve come across the same issue after adding the following dependency:

And the reason was that latest version of evernote uses dependencies to AndroidX, while I had support library version 27.1.1 in my project. So there was an option of upgrading support libraries to 28.0.0, as the other answers suggest, but that was a bit tricky for a large project with lots of custom views. So, I resolved the issue by downgrading evernote version to 1.3.1.

android resource linking failed что делать. Смотреть фото android resource linking failed что делать. Смотреть картинку android resource linking failed что делать. Картинка про android resource linking failed что делать. Фото android resource linking failed что делать

It may sound banal, but for me Build > Clean Project fixed this error without any other changes.

I’m using Studio 3.3.1 Build from Jan 28.

For me I was getting the «error android resource linking failed» pointing to a line in a layout file using ConstraintLayout that had been working correctly until today when the only change to my app level gradle file was to update the versions of:

The error message said something about not recognizing layout_constraintTop_toTopOf which of course is silly because it had been compiling quite happily for months.

I am already on 28.0.3 of build tools and compileSdkVersion of 28. I’ve been using androidx.appcompat everywhere for a while now (converted this project months back to androidx).

I first went through a project clean (no help), and invalidating cache/restart (no help). The layout in question had been originally defined using

, and components (which had been working fine until today).

But after reading the above answers I thought maybe somehow there was confusion being caused here so I changed the layout to use:

So something strange in that widget definition I thought. here is what it was:

I then pasted back the block I had Ctrl-V cut previously and changed the references back to that ID in the other components that reference it in the layout. Compile failed.

I don’t know what to make of this. Perhaps some spurious invisible character was in the file originally?

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *