我在尝试使用以下gradle和依赖项创建捆绑包时遇到问题
项目gradle:
buildscript {
ext.kotlin_version = '1.2.51'
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-beta05'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
flatDir {
dirs 'libs'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
project.ext {
build_tools_version="27.0.3"
min_sdk_version=17
target_sdk_version=27
compile_sdk_version=27
support_version = "27.1.1"
google_play_services_version = "11.8.0"
}
}
应用程序gradle:
dependencies {
implementation(name: 'GoogleConversionTrackingSdk-2.2.4', ext: 'jar')
implementation(name: 'leap_sdk', ext: 'aar')
implementation(name: 'SecureComponent-PROD-V1.5', ext: 'aar')
implementation(name: 'secure-component-sdk', ext: 'jar')
implementation project(':qrcodereaderview')
implementation project(':applib')
implementation project(':mapmarkerclustering')
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.squareup:otto:1.3.8'
implementation ('com.jakewharton:butterknife:8.8.1')
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.okhttp:okhttp:2.3.0'
implementation ('com.facebook.android:facebook-android-sdk:4.7.0')
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
implementation 'commons-codec:commons-codec:20041127.091804'
implementation 'com.github.castorflex.smoothprogressbar:library-circular:1.0.0'
implementation ('com.birbit:android-priority-jobqueue:2.0.1')
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation 'com.squareup.wire:wire-runtime:1.6.1'
implementation 'com.squareup:tape:1.2.3'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true;
}
implementation('com.github.ozodrukh:CircularReveal:1.1.1@aar') {
transitive = true;
}
implementation('com.moengage:moe-android-sdk:9.1.04') {
exclude group: 'com.moengage', module: 'moe-location-lib'
exclude group: 'com.moengage', module: 'moe-push-firebase'
exclude module: 'appcompat-v7'
}
implementation 'com.moengage:moe-push-gcm:3.1.00'
implementation ('com.moengage:addon-messaging:2.0.04')
{
exclude group: 'com.android.support'
}
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation ('in.juspay:godel:0.6.24.1423')
{
exclude group: 'com.android.support'
}
implementation 'com.madgag.spongycastle:core:1.54.0.0'
implementation 'com.madgag.spongycastle:prov:1.54.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.0'
//Charts lib
implementation ('com.github.evgenyneu:js-evaluator-for-android:v2.0.0')
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation "com.android.support:customtabs:$support_version"
//SafetyNet dependency
implementation ("com.google.android.gms:play-services-safetynet:${google_play_services_version}")
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.appsflyer:af-android-sdk:4+@aar'
implementation 'com.android.installreferrer:installreferrer:1.0'
implementation('com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.5')
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation 'com.github.drawers:SpinnerDatePicker:1.0.4'
implementation "com.google.firebase:firebase-core:$google_play_services_version"
implementation "com.google.android.gms:play-services-tagmanager:$google_play_services_version"
implementation 'com.github.clans:fab:1.6.4'
implementation "com.android.support:gridlayout-v7:${support_version}"
implementation "com.android.support:support-v4:${support_version}"
implementation "com.android.support:cardview-v7:${support_version}"
implementation "com.android.support:recyclerview-v7:${support_version}"
implementation "com.android.support:design:${support_version}"
implementation ("com.google.android.gms:play-services-gcm:${google_play_services_version}")
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation ("com.google.firebase:firebase-appindexing:${google_play_services_version}")
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation ("com.google.android.gms:play-services-ads:${google_play_services_version}")
{
exclude group: 'com.android.support'
exclude module: 'support-v4'
}
implementation "com.google.firebase:firebase-config:$google_play_services_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "com.android.support:support-v4:$support_version"
implementation (name: "razorpay-android-3.1.0", ext: 'aar')
implementation (name:"formbuilder-release", ext:'aar')
和依赖性
+--- :GoogleConversionTrackingSdk-2.2.4
+--- :leap_sdk
+--- :SecureComponent-PROD-V1.5
+--- :secure-component-sdk
+--- project :qrcodereaderview
| \--- com.google.zxing:core:3.3.0
+--- project :applib
| +--- project :analytics-1.0
| +--- com.amazonaws:aws-android-sdk-core:2.2.13 -> 2.2.22
| | \--- com.google.code.gson:gson:2.2.4
| +--- com.amazonaws:aws-android-sdk-s3:2.2.+ -> 2.2.22
| | \--- com.amazonaws:aws-android-sdk-core:2.2.22 (*)
| +--- com.amazonaws:aws-android-sdk-cognito:2.2+ -> 2.2.22
| | \--- com.amazonaws:aws-android-sdk-core:2.2.22 (*)
| \--- com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.+ -> 2.2.22
| \--- com.amazonaws:aws-android-sdk-core:2.2.22 (*)
+--- project :mapmarkerclustering
| +--- com.google.android.gms:play-services-maps:11.8.0
| | +--- com.google.android.gms:play-services-base:11.8.0
| | | +--- com.google.android.gms:play-services-basement:11.8.0
| | | | +--- com.android.support:support-v4:25.2.0 -> 27.0.2
| | | | | +--- com.android.support:support-compat:27.0.2
| | | | | | +--- com.android.support:support-annotations:27.0.2
| | | | | | \--- android.arch.lifecycle:runtime:1.0.3
| | | | | | +--- android.arch.lifecycle:common:1.0.3
| | | | | | \--- android.arch.core:common:1.0.0
| | | | | +--- com.android.support:support-media-compat:27.0.2
| | | | | | +--- com.android.support:support-annotations:27.0.2
| | | | | | \--- com.android.support:support-compat:27.0.2 (*)
| | | | | +--- com.android.support:support-core-utils:27.0.2
| | | | | | +--- com.android.support:support-annotations:27.0.2
| | | | | | \--- com.android.support:support-compat:27.0.2 (*)
| | | | | +--- com.android.support:support-core-ui:27.0.2
| | | | | | +--- com.android.support:support-annotations:27.0.2
| | | | | | \--- com.android.support:support-compat:27.0.2 (*)
| | | | | \--- com.android.support:support-fragment:27.0.2
| | | | | +--- com.android.support:support-compat:27.0.2 (*)
| | | | | +--- com.android.support:support-core-ui:27.0.2 (*)
| | | | | +--- com.android.support:support-core-utils:27.0.2 (*)
| | | | | \--- com.android.support:support-annotations:27.0.2
| | | | \--- com.google.android.gms:play-services-basement-license:11.8.0
| | | +--- com.google.android.gms:play-services-tasks:11.8.0
| | | | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | | | \--- com.google.android.gms:play-services-tasks-license:11.8.0
| | | \--- com.google.android.gms:play-services-base-license:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | \--- com.google.android.gms:play-services-maps-license:11.8.0
| \--- com.google.android.gms:play-services-location:11.8.0
| +--- com.google.android.gms:play-services-base:11.8.0 (*)
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| \--- com.google.android.gms:play-services-location-license:11.8.0
+--- com.android.support:multidex:1.0.3
+--- com.mcxiaoke.volley:library:1.0.19
+--- com.squareup:otto:1.3.8
+--- com.jakewharton:butterknife:8.8.1
| \--- com.jakewharton:butterknife-annotations:8.8.1
+--- com.squareup.okhttp:okhttp:2.3.0
| \--- com.squareup.okio:okio:1.3.0 -> 1.8.0
+--- com.facebook.android:facebook-android-sdk:4.7.0
| \--- com.parse.bolts:bolts-android:1.2.0
+--- com.squareup.okhttp:okhttp-urlconnection:2.3.0
| \--- com.squareup.okhttp:okhttp:2.3.0 (*)
+--- commons-codec:commons-codec:20041127.091804
+--- com.github.castorflex.smoothprogressbar:library-circular:1.0.0
+--- com.birbit:android-priority-jobqueue:2.0.1
| \--- com.squareup.okio:okio:1.8.0
+--- com.squareup.wire:wire-runtime:1.6.1
| \--- com.squareup.okio:okio:1.2.0 -> 1.8.0
+--- com.squareup:tape:1.2.3
+--- com.crashlytics.sdk.android:crashlytics:2.9.4
| +--- io.fabric.sdk.android:fabric:1.4.3
| +--- com.crashlytics.sdk.android:crashlytics-core:2.6.3
| | +--- com.crashlytics.sdk.android:answers:1.4.2
| | | \--- io.fabric.sdk.android:fabric:1.4.3
| | \--- io.fabric.sdk.android:fabric:1.4.3
| +--- com.crashlytics.sdk.android:beta:1.2.9
| | \--- io.fabric.sdk.android:fabric:1.4.3
| \--- com.crashlytics.sdk.android:answers:1.4.2 (*)
+--- com.github.ozodrukh:CircularReveal:1.1.1
| \--- com.nineoldandroids:library:2.4.0
+--- com.moengage:moe-android-sdk:9.1.04
| +--- com.moengage:moengagesdk:3.1.04
| +--- com.moengage:pushbase:3.1.00
| +--- com.moengage:inapp:3.1.00
| +--- com.moengage:addon-messaging:3.1.00
| \--- com.moengage:addon-realtime-trigger:2.1.01
+--- com.moengage:moe-push-gcm:3.1.00
+--- com.moengage:addon-messaging:2.0.04 -> 3.1.00
+--- com.github.bumptech.glide:glide:3.7.0
+--- in.juspay:godel:0.6.24.1423
| \--- in.juspay:godel-osd:0.6.20
+--- com.madgag.spongycastle:core:1.54.0.0
+--- com.madgag.spongycastle:prov:1.54.0.0
| \--- com.madgag.spongycastle:core:1.54.0.0
+--- com.github.PhilJay:MPAndroidChart:v3.0.0
+--- com.github.evgenyneu:js-evaluator-for-android:v2.0.0
+--- com.android.support:customtabs:27.0.2
| +--- com.android.support:support-compat:27.0.2 (*)
| \--- com.android.support:support-annotations:27.0.2
+--- com.google.android.gms:play-services-safetynet:11.8.0
| +--- com.google.android.gms:play-services-base:11.8.0 (*)
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| \--- com.google.android.gms:play-services-safetynet-license:11.8.0
+--- com.android.support.constraint:constraint-layout:1.1.2
| \--- com.android.support.constraint:constraint-layout-solver:1.1.2
+--- com.appsflyer:af-android-sdk:4+ -> 4.8.14
+--- com.android.installreferrer:installreferrer:1.0
+--- com.firebase:firebase-jobdispatcher-with-gcm-dep:0.8.5
+--- com.github.drawers:SpinnerDatePicker:1.0.4
+--- com.google.firebase:firebase-core:11.8.0
| \--- com.google.firebase:firebase-analytics:11.8.0
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.firebase:firebase-common:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| | \--- com.google.firebase:firebase-common-license:11.8.0
| +--- com.google.firebase:firebase-analytics-impl:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | +--- com.google.firebase:firebase-iid:11.8.0
| | | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | | +--- com.google.firebase:firebase-common:11.8.0 (*)
| | | +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| | | \--- com.google.firebase:firebase-iid-license:11.8.0
| | +--- com.google.firebase:firebase-common:11.8.0 (*)
| | +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| | \--- com.google.firebase:firebase-analytics-impl-license:11.8.0
| \--- com.google.firebase:firebase-analytics-license:11.8.0
+--- com.google.android.gms:play-services-tagmanager:11.8.0
| +--- com.google.android.gms:play-services-analytics-impl:11.8.0
| | +--- com.google.android.gms:play-services-base:11.8.0 (*)
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | \--- com.google.android.gms:play-services-analytics-impl-license:11.8.0
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.android.gms:play-services-tagmanager-api:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | +--- com.google.firebase:firebase-analytics:11.8.0 (*)
| | \--- com.google.android.gms:play-services-tagmanager-api-license:11.8.0
| \--- com.google.android.gms:play-services-tagmanager-license:11.8.0
+--- com.github.clans:fab:1.6.4
+--- com.android.support:gridlayout-v7:27.0.2
| +--- com.android.support:support-compat:27.0.2 (*)
| \--- com.android.support:support-core-ui:27.0.2 (*)
+--- com.android.support:support-v4:27.0.2 (*)
+--- com.android.support:cardview-v7:27.0.2
| \--- com.android.support:support-annotations:27.0.2
+--- com.android.support:recyclerview-v7:27.0.2
| +--- com.android.support:support-annotations:27.0.2
| +--- com.android.support:support-compat:27.0.2 (*)
| \--- com.android.support:support-core-ui:27.0.2 (*)
+--- com.android.support:design:27.0.2
| +--- com.android.support:support-v4:27.0.2 (*)
| +--- com.android.support:appcompat-v7:27.0.2
| | +--- com.android.support:support-annotations:27.0.2
| | +--- com.android.support:support-core-utils:27.0.2 (*)
| | +--- com.android.support:support-fragment:27.0.2 (*)
| | +--- com.android.support:support-vector-drawable:27.0.2
| | | +--- com.android.support:support-annotations:27.0.2
| | | \--- com.android.support:support-compat:27.0.2 (*)
| | \--- com.android.support:animated-vector-drawable:27.0.2
| | +--- com.android.support:support-vector-drawable:27.0.2 (*)
| | \--- com.android.support:support-core-ui:27.0.2 (*)
| +--- com.android.support:recyclerview-v7:27.0.2 (*)
| \--- com.android.support:transition:27.0.2
| +--- com.android.support:support-annotations:27.0.2
| \--- com.android.support:support-compat:27.0.2 (*)
+--- com.google.android.gms:play-services-gcm:11.8.0
| +--- com.google.android.gms:play-services-base:11.8.0 (*)
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.android.gms:play-services-iid:11.8.0
| | +--- com.google.android.gms:play-services-base:11.8.0 (*)
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | \--- com.google.android.gms:play-services-iid-license:11.8.0
| \--- com.google.android.gms:play-services-gcm-license:11.8.0
+--- com.google.firebase:firebase-appindexing:11.8.0
| +--- com.google.android.gms:play-services-base:11.8.0 (*)
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.firebase:firebase-common:11.8.0 (*)
| +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| \--- com.google.firebase:firebase-appindexing-license:11.8.0
+--- com.google.android.gms:play-services-ads:11.8.0
| +--- com.google.android.gms:play-services-ads-lite:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | \--- com.google.android.gms:play-services-ads-lite-license:11.8.0
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.android.gms:play-services-gass:11.8.0
| | +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| | \--- com.google.android.gms:play-services-gass-license:11.8.0
| \--- com.google.android.gms:play-services-ads-license:11.8.0
+--- com.google.firebase:firebase-config:11.8.0
| +--- com.google.android.gms:play-services-base:11.8.0 (*)
| +--- com.google.android.gms:play-services-basement:11.8.0 (*)
| +--- com.google.firebase:firebase-iid:11.8.0 (*)
| +--- com.google.firebase:firebase-common:11.8.0 (*)
| +--- com.google.android.gms:play-services-tasks:11.8.0 (*)
| \--- com.google.firebase:firebase-config-license:11.8.0
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.2.51
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.51
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.2.51
| \--- org.jetbrains:annotations:13.0
+--- org.jetbrains.kotlin:kotlin-reflect:1.2.51
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.2.51 (*)
+--- :razorpay-android-3.1.0
+--- :formbuilder-release
\--- com.android.support:multidex:1.0.2 -> 1.0.3
原因:com.android.tools.r8.errors.CompilationError:程序类型已存在:android.support.v7.appcompat.R 在com.android.tools.r8.utils.ProgramClassCollection.resolveClassConflictImpl(ProgramClassCollection.java:64) 在com.android.tools.r8.utils.ProgramClassCollection.lambda $ create $ 0(ProgramClassCollection.java:25) 在java.util.concurrent.ConcurrentHashMap.merge(ConcurrentHashMap.java:1990) 在com.android.tools.r8.utils.ProgramClassCollection.create(ProgramClassCollection.java:24) 在com.android.tools.r8.graph.LazyLoadedDexApplication $ Builder.build(LazyLoadedDexApplication.java:124) 在com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:123) 在com.android.tools.r8.dex.ApplicationReader.read(ApplicationReader.java:86) 在com.android.tools.r8.GenerateMainDexList.run(GenerateMainDexList.java:40) 在com.android.tools.r8.GenerateMainDexList.run(GenerateMainDexList.java:110) 在com.android.builder.multidex.D8MainDexList.generate(D8MainDexList.java:83) ... 52更多
据我了解,同一库具有不同版本,但无法修复,我已经尝试过 exclude and configureAll 选项
答案 0 :(得分:2)
我通过以下步骤解决了我的问题:
multidexEnabled false
-mutidex
选项一起使用。