EDIT: Solution from Error: java.util.zip.ZipException: duplicate entry doesn't work here, because I don't have problem with support-v4 module
I'm trying to build an Android project which uses SpongyCastle, but unfortunately it requires javax.naming package from jndi library.
I added jndi and even javaEE to make it work, but gradle still has problem with running a project (build is successful)
My gradle.build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "grylls.cryptotexting"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'javax:javaee-api:7.0'
compile files('lib/jndi-1.2.1.jar')
}
Gradle throws this error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.>
com.android.build.api.transform.TransformException:java.util.zip.ZipException:
duplicate entry:javax/mail/AuthenticationFailedException.class
When I tried to exclude javax.mail from javax:javaee-api:7.0 I got:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException:
Process 'command 'C:\Program Files\Java\jdk1.8.0_40\bin\java.exe'' finished with non-zero exit value 1
Where can I find this duplication of javax.mail which by the way I don't even need?
To properly include SpongyCastle I had to make a change in dependencies :
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.madgag.spongycastle:core:1.51.0.0'
compile 'com.madgag.spongycastle:prov:1.51.0.0'
compile 'com.madgag.spongycastle:pkix:1.51.0.0'
compile 'com.madgag.spongycastle:pg:1.51.0.0'
}
Create a class that inserts BouncyCastle Provider
import android.app.Application;
import java.security.Security;
public class Dynks extends Application {
static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); }
}
and include it in AndroidManifest.xml under "application" tag:
...
<application
android:name="Dynks"
...
Related
I was trying to build an apk for my project but i am facing this error and
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException: com.android.dex.DexException:
Multiple dex files define Lcom/google/android/gms/internal/zzajl;
i also added multiDexEnabled true but still getting error
Error:Execution failed for task
':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/google/android/gms/internal/zzaix.class
Below is my Build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "in.package.name"
minSdkVersion 14
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services-ads:11.0.1'
testCompile 'junit:junit:4.12'
// Adding support library for this demo app
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.firebase:firebase-database:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Please suggest me some solution
Thanks
Use SAME version
compile 'com.google.android.gms:play-services-ads:11.0.1'
compile 'com.google.firebase:firebase-database:11.0.1'
Then Clean-Rebuild and Restart IDE .
Try cleaning the project first - ./gradlew clean
I have problem with compile 'org.mongodb:mongo-java-driver:3.x.x' on Android Studion. I am getting this error:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 2
The error do not appear with 'org.mongodb:mongo-java-driver:2.x.x' So i suppose that it is rather a jdk problem or a problem from mongo driver version 3.x.x.
Here is my gradle file too.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
useLibrary 'org.apache.http.legacy'
repositories {
mavenCentral()
jcenter()
}
defaultConfig {
applicationId "com.example.irakl_000.maps"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:design:23.1.0'
//compile 'com.android.support:percent:23.1.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.isseiaoki:simplecropview:1.0.13'
compile 'org.mongodb:mongo-java-driver:2.9.2' //.....//
}
EDIT:
On a new project the version 3.x.x has no errors on gradle. So jdk should not be a problem. So could it be some kind of limit on size of compile file error like the 65K Limit error?
My gradle.build file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.alexandernohe.mapsappgoogle"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.maps.android:android-maps-utils:0.4.3'
compile 'com.firebase:firebase-client-android:2.5.1+'
compile 'com.android.support:support-v4:23.2.1'
compile 'com.android.support:design:23.2.1'
}
I have enabled multidexing and have tried deleting the app/build folder but my application still will not build. If I remove the design library it will build but then I am unable to use a floating action button in my fragment, nor a coordinated layout. Most of the current solutions on here reference posts to enable multidexing, however, looking at the build file, you should see that it is enabled. I have a feeling that a library listed may overlap with the design library but as far as I can tell based upon googles documentation, they are different.
Here is the error code:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
>com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
EDIT:
I forgot to mention, I have also performed a clean on the project as well.
Try this inside the android block of your build.gradle:
dexOptions {
javaMaxHeapSize "4g"
}
i am trying to use dm77/barcodescanner zxing from github and i've been trying to use this library but i always get
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_60\bin\java.exe'' finished with non-zero exit value 2
i've searched to other app:dex:Debug questions and problems and they said that i may have multiple dependencies. i tried to check it but i can't detect what or where these "multiple dependencies" are.
here's my code:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.quest.questsuser"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.akexorcist:RoundCornerProgressBar:2.0.3'
compile 'com.github.ksoichiro:Android-ObservableScrollView:v1.6.0'
compile 'com.melnykov:floatingactionbutton:1.0.7'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1#aar'
compile 'com.daimajia.androidanimations:library:1.1.3#aar'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.12.0'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
}
repositories {
maven {
url "https://jitpack.io"
}
}
your help with be greatly appreciated.
I've already found the solution from https://www.youtube.com/watch?v=7uzWEjTVLQ4.
1. I added multiDexEnabled true in the default config build.gradle, added compile 'com.android.support:multidex:1.0.0' in the dependencies and in my Application Class i added a MultiDex.install(this); in the onCreate method
I know that this is an error that it has been asked in a question before but I havent found any answer that suits me.
This is my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.hvfhirapp"
minSdkVersion 16
targetSdkVersion 21
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
configurations{
compile.exclude module: 'commons-codec'
compile.exclude module: 'javax.json'
}
dependencies {
compile project(':androidsdksimplexml')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'ca.uhn.hapi.fhir:hapi-fhir-base:1.1'
compile 'ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2:1.1'
compile 'com.android.support:multidex:1.0.1'
}
android {
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
}
As you can see I have entered the multiDexEnabled = true and I have also added the dependcy of MultiDex + the line in my manifest's application.
Also my exact error in the stack trace in gradle console is:
* What went wrong:
Execution failed for task ':hVFhirApp:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Also what I would like to add is the fact that when I remove the excludes in my dependencies bracket the error that shows up is
* What went wrong:
Execution failed for task ':hVFhirApp:packageAllDebugClassesForMultiDex'.
> java.util.zip.ZipException: duplicate entry: org/apache/commons/codec/binary/Base64.class
and that's why I exclude them
Any help would be of much appreciation.
Thank you in advance
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
Add this to your gradle and clean the entire the project and build.Still if it is not working then uninstall JAVA from your machine and reinstall again