Failed linking file resources

后端 未结 25 1005
悲&欢浪女
悲&欢浪女 2020-12-01 03:09

This is the java file that is giving the error

package com.example.daksh.timetable;

import android.support.v7.app.AppCompatActivity;
import         


        
相关标签:
25条回答
  • 2020-12-01 03:44

    My error was in a xml drawable file. I had the first liner duplicate. Changing it to this worked for me:

    <?xml version="1.0" encoding="utf-8"?>
    
    0 讨论(0)
  • 2020-12-01 03:45

    I had the same problem but it occured in all my projects, I tried Invalidate Cache / Restart but even it doesn´t solved the problem.

    At the end I realized that in my Gradle Settings, Offline Work was enabled.

    Go to Build, Execution, Deployment > Gradle in Gradle Settings unchecked Offline Work.

    It solved the the problem downloading some configuration files for my Android Studio.

    0 讨论(0)
  • 2020-12-01 03:46

    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:

    <?xml version="1.0" encoding="utf-8"?>
    <?xml version="1.0" encoding="utf-8"?> <!-- Remove this one -->
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
         <solid android:color="@color/mug_blue"/>
         <corners android:radius="@dimen/featured_radius" />
    </shape>
    

    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.

    0 讨论(0)
  • 2020-12-01 03:46

    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.

    0 讨论(0)
  • 2020-12-01 03:46

    I was having the same issue. It was due to a typo in an attribute in one of my XML file. Anyways, Android Studio did not specify the source of the error in the first run. But when I did a

    Build -> Clean Project

    and then ran the app again it showed me the exact line in the XML code where the typo was.

    0 讨论(0)
  • 2020-12-01 03:46

    Sometimes it happen what you copy paste code from another project fro example you copy

    <android.support.design.widget.NavigationView
            android:id="@+id/nav_view"
            android:layout_width="256dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="@android:color/white"
            android:fitsSystemWindows="true"
            app:headerLayout="@layout/nav_header_main"
            app:itemTextColor="@color/colorDrawerItems"
            app:menu="@menu/activity_main_drawer" />
    

    Unfortunately Android studio not always show dependency error, but what happen is that class NavigationView is missing because implementation 'com.android.support:design not added to the project

    0 讨论(0)
提交回复
热议问题