我将'android.support:appcompat-v7‘更新为28.0.0
。
但它带来了构建过程中的错误。
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-23:19 to override.
然后我在我的Logcat中得到这个错误:
清单合并失败
我的app.gradle:
configurations.all {
resolutionStrategy.force 'com.android.support:design:28.0.0'
resolutionStrategy.force "com.android.support:support-v4:28.0.0"
resolutionStrategy.force "com.android.support:support-media-compat:28.0.0"
}
...
dependencies {
implementation 'com.android.support:multidex:1.0.1'
// Our dependencies
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
我该如何修复它?
我需要你的解决方案。
提前谢谢你。
发布于 2019-06-18 13:56:12
我通过搜索@MehulSolanki answer找到了一个解决方案。
我补充说
tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"
在我的AndroidManifest.xml
上
并更新com.android.tools.build:gradl:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
并将其添加到您的gradle.properties文件中
android.useAndroidX=true
android.enableJetifier=true
错误:标记无法解析变量'${animal.sniffer.version}‘
错误:标记无法解析变量'${junit.version}‘
如果出现上述错误
错误:包android.support.annotation不存在错误:找不到可为空的符号类
如果出现上述错误
添加implementation 'androidx.annotation:annotation:1.1.0'
更改import android.support.annotation.Nullable;
=> androidx.annotation.Nullable;
更改import android.support.annotation.NonNull;
=> androidx.annotation.NonNull;
编译版本和目标版本应为28.
发布于 2019-06-18 18:12:16
将'react-native-device-info'
升级到version 2.1.2
为我修复了这个错误。请参阅github.com/facebook/react-native/issues/25294#issuecomment-503024749
简而言之:该库使用"services-gcm:+"
作为依赖项,而最新的gcm版本导致了这个问题。
发布于 2019-06-18 18:32:11
根本原因是迁移到Androidx
,谷歌play服务更新到androidX感谢MR03web这个问题属于react-native-device-info?最佳选择是使用以下命令升级react-native-device-info
yarn upgrade react-native-device-info@2.1.2
cd android && gradlew clean
react-native run-android
或者,如果你不想升级,你应该像这样从react-native-device-info
中排除com.google.android.gms
。谢谢
implementation(project(":react-native-device-info"), {
exclude group: "com.google.android.gms"
})
implementation "com.google.android.gms:play-services-gcm:16.0.0"
https://stackoverflow.com/questions/56642369
复制相似问题