【问题标题】:implementation error in gradle scripts - android studio api28 [duplicate]gradle脚本中的实现错误 - android studio api28 [重复]
【发布时间】:2019-07-31 20:38:12
【问题描述】:

我正在尝试实施 Google 服务,例如广告和 Firebase。 我为每个工具使用最新版本。

我尝试添加 //noinspection GradleCompatible,更改某些实现的版本并添加工具:replace="android:appComponentFactory to Manifest

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support.constraint:constraint-layout:2.0.0-beta2'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:support-annotations:28.0.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    testImplementation 'junit:junit:4.13-beta-3'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.google.android.gms:play-services-ads:18.1.1'
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.android.gms:play-services-auth:17.0.0'

}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

帮我解决这个错误。

Error: Manifest merger failed : Attribute application@appComponentFactory 
value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
    is also present at [androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:8:5-76:19 to override.

【问题讨论】:

    标签: java android android-studio


    【解决方案1】:

    将这些标志放在你的 gradle.properties 中

    android.enableJetifier=true
    android.useAndroidX=true
    

    【讨论】:

    • 成功了,谢谢。您是否也知道如何解决此警告:警告:API 'variant.getMergeResources()' 已过时并已替换为'variant.getMergeResourcesProvider()'。它将在 2019 年底被删除。有关更多信息,请参阅d.android.com/r/tools/task-configuration-avoidance。要确定调用 variant.getMergeResources() 的内容,请在命令行上使用 -Pandroid.debug.obsoleteApi=true 以显示更多信息。受影响的模块:app
    • @EladKellner 使用这个 Def 实现 "com.google.ar.sceneform.ux:sceneform-ux:1.5.1" 并检查它是否有效。
    • 它没有。我刚刚看到我有导入错误,因为更改了属性。他无法解析 import android.support.v7.app.AppCompatActivity;
    • 知道了。只需针对这个问题发布一个新问题。
    猜你喜欢
    • 2017-10-05
    • 2023-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-18
    • 1970-01-01
    • 2018-11-11
    相关资源
    最近更新 更多