当我尝试在android studio 3.0.1上构建项目时,出现此错误。
- Error:Note: Some input files use or override a deprecated API.
- Note: Recompile with -Xlint:deprecation for details.
- Note: Some input files use unchecked or unsafe operations.
- Note: Recompile with -Xlint:unchecked for details.
- FAILURE: Build failed with an exception.
> What went wrong:
Execution failed for task':app:transformClassesWithJarMergingForDebug'
.com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry: com/google/firebase/iid/zzc.class
有关该项目的一些信息:
- compileSdkVersion:26个
- buildToolsVersion:26.0.1
- minSdkVersion:15
- targetSdkVersion:24个
- classpath'com.android.tools.build:gradle:2.3.1'
- com.google.firebase:firebase:12.0.1
- android studio:3.0.1
这是build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
maven {
url 'https://jitpack.io'
}
}
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
}
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
}
}
ext {
supportlib_version = '26.1.0'
gps_version = '11.2.0'
}
//Ensure that all dependencies use the same version of the Android Support library
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version"
}
if (details.requested.group == 'com.google.android.gms'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$gps_version"
}
}
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
// apply plugin: 'com.google.gms.google-services'
和build.gradle(应用程序):
apply plugin: 'com.android.application'
android {
configurations {
all*.exclude module: 'android.support.v4'
}
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId 'com.hamkaret.patoghfarhang'
minSdkVersion 15
targetSdkVersion 24
multiDexEnabled true
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
//Optionally configure your OneSignal IDs below
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "",
onesignal_google_project_number: ""]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
jumboMode true
}
productFlavors {
}
}
repositories {
flatDir {
dirs 'libs'
}
maven {
url "https://jitpack.io"
}
jcenter();
}
dependencies {
compile 'co.ronash.android:pushe-base:1.4.3'
compile 'com.devbrackets.android:exomedia:4.0.3'
//TV
compile 'com.google.android.exoplayer:exoplayer:r2.4.3'
//TV & Radio
compile 'com.cleveroad:audiovisualization:1.0.0'
//Radio
compile 'com.google.code.gson:gson:2.8.0'
//WC
compile 'com.squareup.okhttp3:okhttp:3.7.0'
//WC
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.onesignal:OneSignal:[3.6.5,4.0.0)'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.booking:rtlviewpager:1.0.1'
compile 'com.github.apg-mobile:android-round-textview:v0.0.3'
compile 'com.github.chrisbanes:PhotoView:1.3.0'
compile "com.android.support:cardview-v7:$supportlib_version"
compile ('com.android.support:appcompat-v7:$supportlib_version') {
exclude group: 'com.android.support', module:'support-v4'
}
compile "com.android.support:recyclerview-v7:$supportlib_version"
compile "com.android.support:design:$supportlib_version"
//compile "com.android.support:support-v4:$supportlib_version"
compile "com.android.support:support-core-utils:$supportlib_version"
compile "com.android.support:support-media-compat:$supportlib_version"
compile "com.google.android.gms:play-services-gcm:$gps_version"
compile "com.google.android.gms:play-services-ads:$gps_version"
compile "com.google.android.gms:play-services-maps:$gps_version"
compile 'com.google.maps.android:android-maps-utils:0.5+'
compile files('libs/YouTubeAndroidPlayerApi.jar')
}