错误:找不到资源android:attr/fontVariationSettings

Mid*_*laj 121 android android-gradle-plugin

警告:该android.dexOptions.incremental属性已弃用,它对构建过程没有影响./home/midhilaj/.gradle/caches/transforms-1/files-1.1/appcompat-v7-26.1.0.aar/be3106efb0df111fe5a3f7b356dd070b/res/values/values.xml错误:(246,5)错误:资源android:attr/fontVariationSettings未找到./project/bkup/7_march_2018/hyshoper/milla/build/intermediates/incremental/mergeDebugAndroidTestResources/merged.dir/values/values.xml错误:(246,5)错误:找不到资源android:attr/ttcIndex.错误:(269)资源android:attr/ttcIndex未找到.错误:(269)资源android:attr/fontVariationSettings未找到.错误:java.util.concurrent.ExecutionException:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息错误:链接引用失败.错误:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息错误:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息错误:执行失败for task':milla:processDebugAndroidTestResources'.

无法执行aapt信息:9错误信息:2秒内建立失败信息:1警告信息:在控制台中查看完整输出

如何解决这个问题?我的依赖

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })


    compile 'de.hdodenhof:circleimageview:2.2.0'



    compile('com.alibaba.android:ultraviewpager:1.0.6.1@aar') {
        transitive = true
    }
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'com.synnapps:carouselview:0.1.4'
    compile 'com.sun.mail:android-mail:1.5.5'
    compile 'com.sun.mail:android-activation:1.5.5'
    implementation 'com.muddzdev:styleabletoast:2.0.2'
    compile 'javax.annotation:javax.annotation-api:1.2'




    compile 'me.grantland:autofittextview:0.2.+'
    // base library
     //slider
    compile 'com.ss.bannerslider:bannerslider:1.8.0'
    //noinspection GradleCompatible
    compile 'jp.wasabeef:recyclerview-animators:2.2.7'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.satyan:sugar:1.4'
    compile 'com.android.support:multidex:1.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:percent:26.1.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.github.satyan:sugar:1.4'
    compile 'jp.wasabeef:recyclerview-animators:2.2.6'
    compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
    compile 'com.afollestad.material-dialogs:core:0.9.4.2'
    compile 'com.google.android.gms:play-services:9.8.0'
    compile 'com.google.android.gms:play-services-auth:9.8.0'
    compile 'com.google.android.gms:play-services-location:9.8.0'
    compile 'com.google.firebase:firebase-core:9.8.0'
    compile 'com.google.firebase:firebase-auth:9.8.0'
    compile 'com.google.firebase:firebase-database:9.8.0'
    compile 'com.google.firebase:firebase-config:9.8.0'
    compile 'com.google.firebase:firebase-crash:9.8.0'
    compile 'com.google.firebase:firebase-invites:9.8.0'
    compile 'com.google.firebase:firebase-storage:9.8.0'
    compile 'cn.pedant.sweetalert:library:1.3'
    compile 'at.blogc:expandabletextview:1.0.3'
    compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.+'
    compile 'com.android.support:appcompat-v7:26.1.0'

    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:cardview-v7:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:recyclerview-v7:26.1.0'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    implementation 'com.android.support:design:26.1.0'

}
Run Code Online (Sandbox Code Playgroud)

小智 184

尝试将compileSdkVersion更改为:

compileSdkVersion 28
Run Code Online (Sandbox Code Playgroud)

在api级别添加了fontVariationSettings 28. 这里的Api doc

  • 当我向项目添加最新的Kotlin扩展库时,我不得不更改为版本28,并且出现此错误。谢谢! (2认同)
  • @zyczyc 我的意思是我使用的是 27 并升级到 28 解决了所有问题。我之前尝试过清理和重建,但没有运气。 (2认同)

akh*_*hil 53

这是因为与更改为版本28的android支持库不兼容.我通过强制构建使用较低的支持库来解决问题.//比如建立gradle

configurations.all {
        resolutionStrategy {
                force 'com.android.support:support-v4:27.1.0'
    }
} 
Run Code Online (Sandbox Code Playgroud)

我改变了这个项目后立即成功构建了我的项目 希望这对你也有帮助.因为这个我失去了一天的发展!

  • 这些线放在哪里? (3认同)
  • @Kakashi 将这些行放在 build.gradle(Module:app) 中 (2认同)

小智 14

对于必须保留compileSdkVersion 27并且还不能升级到androidx的那些,您不得在以下链接中升级到(或超过)依赖项的版本。这些链接是引入重大更改的地方。您必须找到不使用androidx的早期版本。

https://firebase.google.com/support/release-notes/android#update_-_june_17_2019

https://developers.google.com/android/guides/releases#june_17_2019

例如,以下与兼容compileSdkVersion 27

dependencies {
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.google.android.gms:play-services-maps:16.1.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.firebase:firebase-messaging:18.0.0'
}
Run Code Online (Sandbox Code Playgroud)

以下将打破,compileSdkVersion 27并且仅与兼容compileSdkVersion 28

dependencies {
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.0'
}
Run Code Online (Sandbox Code Playgroud)

  • 感谢您为需要暂时保留版本27的用户提供解决方案(公认的答案过于简单) (2认同)

Eug*_*noy 6

对于本机Android应用程序(不是Cordova),我的解决方案是:

是:

implementation 'com.android.support:support-v13:+'
Run Code Online (Sandbox Code Playgroud)

现在:

implementation 'com.android.support:support-v13:27.1.1'
Run Code Online (Sandbox Code Playgroud)


bhe*_*ema 6

@所有问题都是由于 2019 年 6 月 17 日发布的 google play 服务和 firebase 中的最新重大变化。

如果您在使用 Ionic 或 Cordova 项目。请使用 + 标记浏览所有依赖 google play 服务和 firebase 服务的插件

例子:

在我的 firebase cordova 集成中,我有 com.google.firebase:firebase-core:+ com.google.firebase:firebase-messaging:+ 所以加号总是下载导致错误的最新版本。根据 2019 年 3 月 15 日发布的版本号更改 + 版本https://developers.google.com/android/guides/releases

确保在cordova库的build.gradle文件中用实际版本替换+符号


Pab*_*rra 5

如果您要更新到v28

将compileSdkVersion更改为 compileSdkVersion 28


Fil*_*yan 5

Ionic 3 开发人员的另一个修复是 在平台/android 中创建build-extras.gradle并放置以下内容

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}
Run Code Online (Sandbox Code Playgroud)

请注意, build-extras.gradle 与 build.gradle 不同


Joh*_*ado 5

我用下面的代码行解决了这个问题:

cordova plugin add cordova-android-support-gradle-release --save
Run Code Online (Sandbox Code Playgroud)

之后,编译成功。