我不知道该怎么做: 我从这里更新到了最新的gradle:https://bintray.com/android/android-tools/com.google.gms.google-services/ 我有最新的gradle插件3.2.1。 还从此处更新到最新的Google Play库: https://developers.google.com/android/guides/setup 和Firebase:https://firebase.google.com/support/release-notes/android 在我的主要build.gradle中,我有这个:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
mavenCentral()
google()
}
}
我的应用程序build.gradle具有以下buildscript依赖项:
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
classpath "io.realm:realm-gradle-plugin:3.2.1"
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
这是正常的依赖关系:
dependencies {
implementation 'com.android.support:multidex:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:transition:28.0.0'
implementation 'com.google.code.gson:gson:2+'
implementation 'com.android.volley:volley:1+'
implementation 'com.squareup.okhttp:okhttp:2.0.0+'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.2'
implementation files('libs/nineoldandroids-2.4.0.jar')
implementation files('libs/okhttp-urlconnection-2.0.0.jar')
implementation 'com.edmodo:cropper:1.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'com.google.maps.android:android-maps-utils:0.4+'
implementation 'io.reactivex:rxjava:1.1.0'
implementation 'com.plattysoft.leonids:LeonidsLib:1.3.1'
implementation 'io.smooch:core:latest.release'
implementation 'io.smooch:ui:latest.release'
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
implementation 'com.squareup.okhttp3:okhttp:3.2.0'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
implementation 'io.branch.sdk.android:library:3.+'
implementation 'com.github.2359media:EasyAndroidAnimations:0.8'
implementation 'me.grantland:autofittextview:0.2.+'
implementation 'com.github.kaknazaveshtakipishi:PermissionEverywhere:1.0.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
transitive = true;
}
implementation(
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
)
implementation 'devlight.io:navigationtabbar:1.2.5'
implementation 'org.apache.commons:commons-lang3:3.4'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-library:0.1.0'
implementation 'commons-io:commons-io:2.4'
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'org.altbeacon:android-beacon-library:2.15.1'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
implementation 'com.brandongogetap:stickyheaders:0.5.1'
implementation 'com.github.Chils17:OdometerLibrary:687d5ac1e9'
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1'
}
这是我得到的错误:
Error: Program type already present: com.google.android.gms.internal.measurement.zzrv
Caused by: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/0.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/1.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/2.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/3.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/4.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/5.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/6.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/7.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/8.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/9.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/10.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/11.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/12.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/13.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/14.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/15.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/16.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/17.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/18.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/19.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/20.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/21.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/22.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/23.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/24.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/25.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/26.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/27.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/28.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/29.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/30.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/31.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/32.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/33.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/34.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/35.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/36.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/37.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/38.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/39.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/40.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/41.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/42.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/43.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/46.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/47.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/48.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/49.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/50.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/51.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/52.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/53.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/54.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/55.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/56.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/57.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/58.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/59.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/60.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/61.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/62.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/63.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/64.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/65.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/66.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/67.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/68.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/69.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/70.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/71.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/72.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/73.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/74.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/75.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/76.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/77.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/78.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/79.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/80.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/81.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/82.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/83.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/84.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/85.jar, /Users/alinrosu/Workspace/passenger-android/passenger/build/intermediates/transforms/dexBuilder/debug/86.jar
从应用程序中删除implementation 'com.google.android.gms:play-services-analytics:16.0.4'
使其生效。但是我需要内部分析,是否有任何想法使分析与此配合工作?
答案 0 :(得分:1)
我制作了一个干净的android应用程序,并添加了相同的清单,然后使用build.gradle文件播放。
我注意到删除:
implementation 'com.google.android.gms:play-services-analytics:16.0.4'
有效。
因此,我在Google上做了一些搜索,找到了最新版本:https://developers.google.com/android/guides/releases
我更新为
implementation 'com.google.android.gms:play-services-analytics:16.0.6'
,现在可以使用
答案 1 :(得分:0)
尝试在您的项目中实施 multidex 。它将解决您的问题。我在某些项目中遇到了同样的问题,同时在项目中添加了太多的库。
要在您的项目中启用multidex,请访问以下链接:
我希望它能解决您的问题。
尝试更新您的Gradle依赖关系并删除与项目相同的库。作为参考,请参考以下我从您的代码中编写的Gradle依赖代码。这将帮助您解决问题。还要阅读这是我在该代码中的注释。
dependencies {
// Remove or Comment this line as we does not require to implement jar file.
// If required then implement particular library one by one
//implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:percent:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:transition:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
// Note: Try to use only one ok HTTP library from below.
// In your code, you are using OKHttp and okhttp3 both library.
// Just use anyone.
// And use same version for okhttp and okhttp url connection
implementation 'com.squareup.okhttp:okhttp:2.7.5'
//Remove this jar file and use below gradle line to use this library
//implementation files('libs/okhttp-urlconnection-2.0.0.jar')
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.7.5'
//Note: This one is latest OKHttp Library which you have to in your project
//implementation 'com.squareup.okhttp3:okhttp:3.12.0'
//implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.12.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
//implementation 'com.google.android.gms:play-services-analytics:16.0.6'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.5'
// This is your firebase analytics library. Try to use it instead of google analytics.
// Remove google analytics
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-config:16.1.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.7@aar') {
transitive = true;
}
//Remove this jar file and use below gradle line to use this library
//implementation files('libs/nineoldandroids-2.4.0.jar')
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.edmodo:cropper:1.0.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
//Check out requirement for rxjava implementation and its steps
//implementation 'io.reactivex:rxjava:1.1.6'
implementation 'io.reactivex:rxjava:1.3.8'
//Note: This is latest library for RxJava version 2 which you should have to use
//implementation "io.reactivex.rxjava2:rxjava:2.2.4"
implementation 'com.plattysoft.leonids:LeonidsLib:1.3.2'
//Note: Try to implement library with its version number.
//Check out below library implementation steps and notes for below library
//implementation 'io.smooch:core:latest.release'
//implementation 'io.smooch:ui:latest.release'
implementation 'io.smooch:core:5.15.0'
implementation 'io.smooch:ui:5.15.0'
implementation "com.daimajia.swipelayout:library:1.2.0@aar"
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
implementation 'com.brandongogetap:stickyheaders:0.5.1'
implementation 'io.branch.sdk.android:library:3.0.3'
implementation 'com.github.2359media:EasyAndroidAnimations:0.8'
implementation 'me.grantland:autofittextview:0.2.1'
implementation 'com.github.kaknazaveshtakipishi:PermissionEverywhere:1.0.2'
/*implementation(
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.4.1'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.4.1']
)*/
implementation(
[group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.7'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.9.7'],
[group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.7']
)
implementation 'devlight.io:navigationtabbar:1.2.5'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'commons-io:commons-io:2.6'
implementation 'com.yahoo.mobile.client.android.util.rangeseekbar:rangeseekbar-library:0.1.0'
// Check Facebook SDK integration notes and try to implement only required part of SDK from notes.
//implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
implementation 'com.facebook.android:facebook-android-sdk:4.39.0'
implementation 'org.altbeacon:android-beacon-library:2.15.1'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
implementation 'com.github.Chils17:OdometerLibrary:687d5ac1e9'
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:core:8.0.1'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
如果可能,请从上述库中删除未使用的库