我的应用级别Gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "24.0.2"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.mss.triplestar"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
}
//====================Add below two line=============
dexOptions {
javaMaxHeapSize "4g" //specify the heap size for the dex process
preDexLibraries = false //delete the already predexed libraries
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:23.4.0'
compile files('libs/dagger-1.2.2.jar')
compile files('libs/javax.inject-1.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
// compile files('libs/libGoogleAnalyticsV2.jar')
compile 'com.google.android.gms:play-services-analytics:9.0.0'
compile files('libs/nineoldandroids-2.4.0.jar')
compile files('libs/vungle-publisher-adaptive-id-3.3.1.jar')
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile project(':wheelLib')
compile 'com.google.android.gms:play-services:9.0.0'
// compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.scottyab:aescrypt:0.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:24.2.0'
}
我的日志输出
Information:Gradle tasks [:app:assembleDebug]
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5 is ignored for debug as it may be conflicting with the internal version provided by Android.
Warning:WARNING: Dependency org.apache.httpcomponents:httpclient:4.5 is ignored for release as it may be conflicting with the internal version provided by Android.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/analytics/internal/Command$1.class
Information:BUILD FAILED
Information:Total time: 2.579 secs
Information:1 error
Information:2 warnings
Information:See complete output in console
这是我的日志输出我正在尝试构建和更新我的项目但是 它给了我这个错误,如果我删除分析jar比我变得容易 跟踪器错误。请帮助我在这一点上陷入困境 。所有的解决方案。提前谢谢
答案 0 :(得分:1)
由于您要为Android版添加legacy version Google AnalyticsSDK,因此应将其删除。
卸下:
compile files('libs/libGoogleAnalyticsServices.jar')
同时将插件添加到应用级底部 build.gradle
:
apply plugin: 'com.google.gms.google-services'
也没有理由同时使用两者:
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services:9.0.0'
并且您不应该使用compile 'com.google.android.gms:play-services:9.0.0'
,因为其中包含每个Google Play服务库 - 仅使用APIs you need。
答案 1 :(得分:0)
变化
buildToolsVersion“24.0.2”到23.0.4