I am not sure what this error means.
Error:Execution failed for task': eCampus : packageAllDefaultFlavorDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v4/print/PrintHelper$1.class
my bulid.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "tw.edu.chu.ecampus"
minSdkVersion 11
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
preDexLibraries = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenCentral()
}
dependencies {
compile project(':G0.10.ABS')//ActionBarSherlock
compile project(':vitamio')
compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.android.support:multidex:1.0.1'
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'
}
Error does not show up during gradle sync. Just when I try to run the application
What could be the problem?
I meet the same error, and I solve it, but I just give u that my case;
my bulid.gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.android.support:appcompat-v7:22.0.0')
compile files('libs/android-async-http-1.4.8.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}
the error for is the com.android.support:appcompat-v7:22.0.0 include the support-v4.jar, so I remove it;
solve build.gradle:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile ('com.android.support:appcompat-v7:22.0.0') {
exclude module: 'support-v4'
}
compile files('libs/android-async-http-1.4.8.jar')
compile files('libs/android-support-v4.jar')
compile files('libs/universal-image-loader-1.9.4-with-sources.jar')
}
so maybe u should check ur dependencies, maybe ur compile files have two files include support-v4
Related
My build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
}
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.rock08.android.demoapp"
minSdkVersion 22
targetSdkVersion 25
versionCode 2
versionName "0.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support:leanback-v17:25.4.0'
compile 'com.android.support:recyclerview-v7:25.4.0'
compile 'com.android.support:preference-v7:25.4.0'
compile 'com.android.support:preference-v14:25.4.0'
compile 'com.android.support:preference-leanback-v17:25.4.0'
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:palette-v7:25.4.0'
}
gradle-wrapper.properties
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
The gradle build is getting failed.
ERROR- Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
This is expected with Gradle 7.2 since the compile and testCompile configurations have been removed.
You must replace compile with implementation and testCompile with testImplementation
My solution is.
jar file Directory is /WEB-INF/lib/MyJarFile.jar :)
flatDir {
name 'lib'
dirs "$rootProject.projectDir/lib"
}
dependencies {
classpath fileTree(dir: 'lib', include: 'MyJarFile.jar')
}
I have added Kotlin library to my existing project. After that I'm getting the build error. I commented all the recently added libraries and checked the main problem is after adding kotlin library
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [/home/imedrix-server/StudioProjects/kardioscreen-operatorapp/app/build/intermediates/multi-dex/debug/componentClasses.jar] (Can't read [/home/imedrix-server/StudioProjects/kardioscreen-operatorapp/app/build/intermediates/transforms/desugar/debug/76.jar(;;;;;;**.class)] (Duplicate zip entry [76.jar:org/intellij/lang/annotations/Flow.class]))
Project gradle
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath ('com.google.firebase:firebase-plugins:1.0.5') {
exclude group: 'com.google.guava', module: 'guava-jdk5'
}
}
}
allprojects {
repositories {
google()
jcenter()
maven {url "https://maven.google.com"}
}
}
And the app gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.example.android'
minSdkVersion 20
targetSdkVersion 27
versionCode 17
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
buildConfigField("String", "BASE_URL", "\"url\"")
buildConfigField("String", "API_KEY", "\"key\"")
}
}
productFlavors {
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude '.readme'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':controllers')
compile files('libs/achartengine-1.2.0.jar')
compile files('libs/dfuLibrary.jar')
compile 'com.android.support:appcompat-v7:27.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
compile 'com.polidea.rxandroidble:rxandroidble:1.0.2'
compile 'com.google.firebase:firebase-crash:11.8.0'
compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
compile 'com.android.support:support-v4:27.0.2'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.jakewharton:butterknife:8.8.1'
testCompile 'junit:junit:4.12'
/*compile 'org.hashids:hashids:1.0.3'
compile 'com.google.dagger:dagger:2.11'
compile 'javax.inject:javax.inject:1'
kapt 'com.google.dagger:dagger-compiler:2.11'
compile 'io.reactivex.rxjava2:rxjava:2.1.3'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
compile 'com.amitshekhar.android:rx2-android-networking:1.0.0'
compile 'com.android.support:multidex:1.0.2'*/
}
apply plugin: 'com.google.gms.google-services'
If I remove the below line from the app gradle everything works fine. But if I add the kotlin library I'm getting the error.
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
How can I use the kotlin and Java together.
Atlast I found the answer, it was due to duplicate entry to annotation which can be solved by using the below lines in the gradle.
configurations {
compile.exclude group : 'org.jetbrains' , module : 'annotations'
}
i use the GTM and have a question,please help me
app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.york.yorkbbs"
minSdkVersion 16
targetSdkVersion 25
versionCode 531
versionName "5.31"
multiDexEnabled true
ndk {
abiFilters "armeabi", "armeabi-v7a"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
dexOptions {
preDexLibraries = true
javaMaxHeapSize "4g"
}
lintOptions{
checkReleaseBuilds false
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile project(':library_googlemap')
compile project(':library_jcvideoplayer')
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-tagmanager:10.2.1'
compile 'com.jakewharton:butterknife:8.0.1'
apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.stripe:stripe-android:3.1.0'
compile 'com.paypal.sdk:paypal-android-sdk:2.15.3'//exclude group: 'com.squareup.okhttp3', module:'okhttp'
compile 'com.facebook.fresco:fresco:0.14.1'
compile 'com.facebook.fresco:animated-gif:0.14.1'
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.2.1'
compile 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:1.0.2'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.amazonaws:aws-android-sdk-s3:2.4.1'
compile project(':Qupaisdk-release')
compile 'com.google.code.findbugs:jsr305:3.0.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.4'
compile 'com.google.dagger:dagger-compiler:2.0.1'
compile 'com.google.dagger:dagger:2.0.1'
compile 'jp.wasabeef:blurry:2.1.1'
}
project build.gradle
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.3.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
allprojects {
repositories {
jcenter()
}
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 9.0.0.
thanks~
You should rectify your build.gradle
No Need
compile project(':library_googlemap') // Remove this line
Finally
compile 'com.google.android.gms:play-services-maps:10.2.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services-tagmanager:10.2.1'
I am getting this error
Error:Execution failed for task ':yourapp:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: android/support/v7/recyclerview/BuildConfig.class
Here is my build.gradle file
android {
compileSdkVersion 22
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.test"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 22
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile (project(':library_slidingmenu')) {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
compile project(':library')
compile 'com.android.support:appcompat-v7:22.2.1'
androidTestCompile 'com.android.support:multidex-instrumentation:1.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.5.0'
compile 'org.projectlombok:lombok:1.16.6'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:cardview-v7:22.1.0'
compile 'com.android.support:recyclerview-v7:22.1.0'
Any idea how to solve it?
If you have a dependency that also declares the recyclerview lib then just exclude it from the dependency. For example imagine your lib library_slidingmenu contains the recyclerview dependency, then we would need to do something like this
dependencies {
compile project(':library_slidingmenu') {
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
// the rest of your dependecies
}
So my project seemed to break at random today, with the error apparently being something about being over 65K methods. After doing some research I realised it was time to use ProGuard and enable multiDex, which seemes to have made things worse. This is the error I get when I try create a release APK:
Error:Execution failed for task
':My-Project:proguardRelease'.
java.io.IOException: Can't write [C:\Users\User-PC\AndroidStudioProjects\MyProject\My-Project\build\intermediates\classes-proguard\release\classes.jar] (Can't read [C:\Users\User-PC\AndroidStudioProjects\MyProject\My-Project\libs\bolts-android-1.2.0.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [a/a.class == bolts-android-1.2.0.jar:bolts/AggregateException.class]))
and my build.gradle file looks like this:
apply plugin: 'com.android.application'
apply plugin: 'com.parse'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.parse.com/repo' }
}
dependencies {
classpath 'com.parse.tools:gradle:1.+'
}
}
dependencies {
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(include: 'ParseCrashReporting-*.jar', dir: 'libs')
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:multidex:1.0.0'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile 'com.github.dkharrat.nexusdialog:nexusdialog:0.2.0'
}
android {
signingConfigs {
config {
// stuff
}
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.kusasa.saleboat"
minSdkVersion 19
targetSdkVersion 21
versionCode 8
versionName "1.0.7"
// Enabling multidex support.
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
res.srcDirs = ['res']
}
}
productFlavors {
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
debuggable false
}
}
}
I have tried cleaning and rebuilding the project several times, to no avail.
Well i think you get this error because you declare two dependencies of bolts-android one in My-Project\libs\bolts-android-1.2.0.jar the other usinge maven with compile 'com.parse.bolts:bolts-android:1.+'
Remove the lib that's on the lib folder.