构建Android Studio项目时出现错误。
程序类型已存在:com.google.android.gms.internal.measurement.zzdz
这是我的 build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.jakewharton.hugo'
apply plugin: 'io.fabric'
apply plugin: 'com.getkeepsafe.dexcount'
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.6.2'
classpath 'com.google.gms:google-services:3.2.1'
}
}
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 202
versionName "2.0.0"
buildConfigField "boolean", "CRASHLYTICS_ENABLED", "false"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
flavorDimensions "type", "name"
productFlavors {
magazines {
dimension "type"
}
magazine {
dimension "name"
// Remove next line to enable Crashlytics and change false to true in second line
ext.enableCrashlytics = false
buildConfigField "boolean", "CRASHLYTICS_ENABLED", "false"
}
wind {
dimension "name"
// Remove next line to enable Crashlytics and change false to true in second line
ext.enableCrashlytics = false
buildConfigField "boolean", "CRASHLYTICS_ENABLED", "false"
}
script {
//// Use custom gradle file if it exists in script product flavor folder
if (new File("./main/src/script/custom.gradle").exists()) {
println 'custom.gradle script exists'
apply from: "../main/src/script/custom.gradle";
} else {
throw new GradleException('No custom.gradle script exists')
}
//applicationId scriptApplicationId
dimension "name"
buildConfigField "boolean", "CRASHLYTICS_ENABLED", "true"
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
}
dependencies {
implementation fileTree(include: '*.jar', dir: 'libs')
//added here
implementation fileTree(include: '*.java', dir: 'libs')
implementation fileTree(include: '*.so', dir: 'libs')
//til here
implementation project(':appiraterAndroid')
implementation 'de.greenrobot:eventbus:2.4.0'
implementation 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'commons-io:commons-io:2.4'
implementation 'io.reactivex:rxandroid:0.24.0'
implementation 'uk.co.chrisjenx:calligraphy:2.1.0'
implementation 'com.github.castorflex.smoothprogressbar:library:1.1.0'
implementation 'com.github.castorflex.smoothprogressbar:library-circular:1.1.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.26@aar'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'net.danlew:android.joda:2.8.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.4.0@aar') {
transitive = true;
}
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-core-utils:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation('com.github.afollestad.material-dialogs:core:0.8.5.5@aar') {
transitive = true
}
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.5'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.android.gms:play-services-ads:17.1.0'
implementation "com.google.android.gms:play-services-base:16.0.1"
}
apply plugin: 'com.google.gms.google-services'
我确定与依赖项和版本有关,但是我找不到。
我试图清理gradle缓存并重新启动Android studio,但是仍然出现上述错误。
答案 0 :(得分:0)
将项目迁移到androidx支持
点击->重构->迁移到AndroidX
并更新库