こんにちは私は、SDKを開発しています、とするとき、私は次のエラーを取得するアプリケーションのproyectにこれらのSDKを追加します。
マニフェスト合併に失敗しました:属性アプリケーション@ appComponentFactory値=(android.support.v4.app.CoreComponentFactory)com.android.support:support-compat:28.0.0]のAndroidManifest.xmlから:22:18から91
is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:22:5-125:19 to override.
build.gradleは次のようなものです
アプリのbuild.gradle
dependencies {
implementation project(':sdkA')
implementation project(':sdkB')
implementation 'org.webrtc:google-webrtc:1.0.28032'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'com.android.support:preference-v14:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'io.michaelrocks:libphonenumber-android:8.4.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.android:flexbox:1.0.0'
implementation 'com.github.woxthebox:draglistview:1.6.3'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
// Google Lifecycle Components
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
}
sdkAのbuild.gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.webrtc:google-webrtc:1.0.28032'
implementation('io.socket:socket.io-client:1.0.0') {
exclude group: 'org.json', module: 'json'
}
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true
}
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
// Google Lifecycle Components
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
sdkBのbuild.gradle
dependencies {
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support:recyclerview-v7:27.1.1"
}
どのようにそれを解決することができますか?
感謝
[OK]を私は最後の日かそこらのために、この問題を自分自身に取り組んできました。悪夢。
私はそれが、少なくとも私はその非常に大きく、追加のアンドロイドの依存関係がたくさんあるに取り組んできたプロジェクトのために今働いています。
マイク・ハーディが大きな助けになっているこの問題を参照してください。https://github.com/mikehardy/jetifier/issues/27
私は0.60.0が上陸したまでAndroidXを避けるためにお勧めします。
THE問題の原因米国のほとんどの問題の原因である+
のGradleの依存関係における範囲選択。
ネイティブ・Googleが分析ブリッジを反応に一例としてここに示されているように:
compile "com.google.android.gms:play-services-analytics:${safeExtGet('googlePlayServicesVersion', '+')}"
compile "com.google.android.gms:play-services-tagmanager-v4-impl:${safeExtGet('googlePlayServicesVersion', '+')}"
私たちのほとんどのために、我々はトップレベルアンドロイド/ build.gradleにgooglePlayServicesVersion値を設定していません
私たちは、指定したいと思うので、googlePlayServicesVersion = "16.+"
+ theresの様々な他のGoogleサービスパッケージ利用できるので、それらはすべて同じバージョン番号ではありません。これは16.XXをキャプチャし、上記行くことはありません。17.XXは、さらに問題を保持しています。
com.android.support:appcompat-v7最も一般的な:そして、我々はまた、Androidのサポート・ライブラリで使用されている28.0.0に設定supportLibVersionにしたいです。
解決
アンドロイド/ build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.+"
}
...
AndroidManifest.xmlにトップライン: <manifest xmlns:tools="http://schemas.android.com/tools"
アプリケーションタグ: tools:replace="android:appComponentFactory" android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
4.10.1を使用してgradle-wrapper.propertiesを確保
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
そして最後に、あなたがアンドロイドXを使用していないことを確認
gradle.properties:
android.enableJetifier=false
android.useAndroidX=false
追加のステップ(あなたがこれを必要とする場合があります)
それは仕事がうまくとしてjetifierを追加しようとしません失敗。私たちはあなたのnode_modulesを介して実行するためにこれを使用すると、すべてが非androidxライブラリを使用していることを確認します。
npm i jetifier --save-dev
若しくは yarn add jetifier --dev
その後、インストール後スクリプトに追加
"scripts": {
"postinstall": "jetify -r"
}