我在Android Studio中得到了以下错误。这是在我最近做的更新之后。我的Android Studio版本是3.4,Gradle版本是5.5.1,插件版本是3.4.2。

Here is the error:

安卓资源链接失败

warn: removing resource com.anirudh.gighub:string/com_facebook_loginview_logged_in_using_facebook_f1gender without required default value.
  F:\gigHub\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1437: error: resource dimen/smallTxtSize (aka com.anirudh.gighub:dimen/smallTxtSize) not found.
  F:\gigHub\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:1438: error: resource drawable/facebook_signin_btn (aka com.anirudh.gighub:drawable/facebook_signin_btn) not found.
  error: failed linking references.****

这里是`build.gradle

//noinspection GradleCompatible
apply plugin: 'com.android.application'
android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.anirudh.gighub"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    testImplementation 'junit:junit:4.13-beta-3'
    implementation 'com.google.firebase:firebase-auth:18.1.0'
    implementation 'com.facebook.android:facebook-login:5.0.1'
    implementation 'com.github.ybq:Android-SpinKit:1.2.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation ` enter code here `
    'com.android.support.test.espresso:espresso-core:3.0.2'
    
1 个评论
伙计们,所有的麻烦都是我所使用的安卓版本。这是你的编码生活中的一个小插曲。创建一个新的项目,并将所有的代码复制到该项目中,这一切都变得不同了。谢谢!;)
java
android
android-studio
gradle-android-test-plugi
Anirudh Vashisht
Anirudh Vashisht
发布于 2019-07-22
6 个回答
Farouq Afghani
Farouq Afghani
发布于 2020-09-24
已采纳
0 人赞同

Try this

1) File -> Invalidate Caches / Restart

2) 删除应用程序下的构建文件(F:\gigHub\app\build)。

3)清洁项目

4) Rebuild Project

第(3)点本身会做第(2)点,所以第(2)点是多余的。
@AnanthRajSingh 是的,但有时它不会清除所有的文件,我确实发生了这种情况。
Bhautik Keraliya
Bhautik Keraliya
发布于 2020-09-24
0 人赞同

1) 检查你的 "dimen.xml "文件并添加该行(如果没有找到该文件,则创建该文件)。

<dimen name="smallTxtSize">14sp</dimen>

2) 检查你的 "drawable "文件夹 "facebook_signin_btn "文件是否找到?(如果没有找到,就创建这个文件)

Shalu T D
Shalu T D
发布于 2020-09-24
0 人赞同

请在Android Studio中尝试以下内容:-

File -> Invalidate Caches / Restart

arniotaki
arniotaki
发布于 2020-09-24
0 人赞同

使用最新的appcompat库。改为后。

implementation 'com.android.support:appcompat-v7:28.0.0' 

一切工作都很好。

Hossein Karami
Hossein Karami
发布于 2020-09-24
0 人赞同

我的问题是,当我用refactor改变我的一个名为 "rating "的类中的变量时,它把所有的android:rating属性改为android:rate,这就造成了这个问题。 对于那些有这个问题的人,请检查gradle build error exactly以获得更多信息。也许这是因为你未定义的xml属性。

thexiv
thexiv
发布于 2020-09-24
0 人赞同

将此作为你当前的构建。 替换代码0】需要与targetSdkVersion相同。

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion 24
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"