Android 添加 AndroidX 库到非 android 项目
Android add AndroidX library to non-androix project
我有一个 Android 应用程序,我想添加这个库:
implementation 'com.google.android.ump:user-messaging-platform:1.0.0'
当我添加它时出现此错误:
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:23:5-209:19 to override.
当我添加这一行时:
tools:replace="android:appComponentFactory"
我收到这个错误:
Error:
tools:replace specified at line:23 for attribute android:appComponentFactory, but no new value specified
知道问题出在哪里吗?我如何添加这个库?也许我可以添加这个库的以前版本?
据我了解,它与 AndroidX
有关,但我不想将我的项目更新为 AndroidX,因为它是一个旧项目,这会给我带来很多问题。
编辑
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:cardview-v7:28.0.0'
implementation "com.android.support:support-compat:28.0.0"
compile 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.ump:user-messaging-platform:1.0.0'
Error: tools:replace specified at line:23 for attribute
android:appComponentFactory, but no new value specified
您应该同时添加两者
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
确保,您在 gradle.properties
文件中添加了以下内容
android.useAndroidX=true
android.enableJetifier=true
仅供参考
implementation 'com.google.android.ump:user-messaging-platform:1.0.0'
We recommend updating your project to use the final version of the support library:
version 28.0.0. This is because AndroidX artifacts with version 1.0.0
are binary equivalent to the Support Library 28.0.0 artifacts.
只需启用 Jetifier 即可获得其他依赖项name-space 已翻译:
android.useAndroidX=true
android.enableJetifier=true
我有一个 Android 应用程序,我想添加这个库:
implementation 'com.google.android.ump:user-messaging-platform:1.0.0'
当我添加它时出现此错误:
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:23:5-209:19 to override.
当我添加这一行时:
tools:replace="android:appComponentFactory"
我收到这个错误:
Error:
tools:replace specified at line:23 for attribute android:appComponentFactory, but no new value specified
知道问题出在哪里吗?我如何添加这个库?也许我可以添加这个库的以前版本?
据我了解,它与 AndroidX
有关,但我不想将我的项目更新为 AndroidX,因为它是一个旧项目,这会给我带来很多问题。
编辑
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:cardview-v7:28.0.0'
implementation "com.android.support:support-compat:28.0.0"
compile 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.ump:user-messaging-platform:1.0.0'
Error: tools:replace specified at line:23 for attribute android:appComponentFactory, but no new value specified
您应该同时添加两者
tools:replace="android:appComponentFactory"
android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
确保,您在 gradle.properties
文件中添加了以下内容
android.useAndroidX=true
android.enableJetifier=true
仅供参考
implementation 'com.google.android.ump:user-messaging-platform:1.0.0'
We recommend updating your project to use the final version of the support library: version 28.0.0. This is because AndroidX artifacts with version 1.0.0 are binary equivalent to the Support Library 28.0.0 artifacts.
只需启用 Jetifier 即可获得其他依赖项name-space 已翻译:
android.useAndroidX=true
android.enableJetifier=true