MongoDB Java Driver version 3.x.x error on Android - java

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?

Related

Error during Building an APK file in Android Studio

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

Java util ConcurrentException: ProcessException in android

I am getting frustrated. Everything was fine in my project. Then i wanted to implement google custom tab and added dependency. But as soon as I sync the project it is showing the error. I tried to remove the dependency but still the problem is occurring. I have searched in google and stackoverflow. All i got is about multiDex. I have added that too but nothing is changed.
The error and stack trace:
Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
Error:Execution failed for task ':app:mergeDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:
The dependency code:
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "razon.tasktodo"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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'
})
repositories {
mavenCentral()
maven {
url 'http://dl.bintray.com/gigamole/maven/'
}
maven { url "https://jitpack.io" }
}
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.github.rey5137:material:1.2.4'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'me.drakeet.materialdialog:library:1.3.1'
compile 'com.github.devlight.navigationtabstrip:navigationtabstrip:+'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'jp.wasabeef:recyclerview-animators:2.2.5'
compile 'com.github.armcha:SpaceNavigationView:1.5.0'
compile 'com.github.devlight:infinitecycleviewpager:1.0.2'
compile 'com.android.support:multidex:1.0.1'
testCompile 'junit:junit:4.12'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
}
Please help me to get rid of it.

Realm and jackOptions Java finished with non-zero exit value 1 - Android Gradle

After upgrading to Android design tools 24, my project won't run anymore. It builds fine without any errors, but when I run it I get the error:
Error:Gradle: 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_102\bin\java.exe'' finished with non-zero exit value 1
This is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.don.mstp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
incremental true
javaMaxHeapSize "4g"
preDexLibraries = false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.github.Lukle:ClickableAreasImages:v0.1'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:support-v4:24.2.0'
compile 'com.android.support:cardview-v7:24.2.0'
compile 'com.android.support:recyclerview-v7:24.2.0'
compile 'com.github.javiersantos:MaterialstyledDialogs:1.3'
compile 'com.github.PhilJay:MPAndroidChart:v2.1.6'
compile 'com.ramotion.foldingcell:folding-cell:1.0.1'
compile 'com.github.brnunes:swipeablerecyclerview:1.0.2'
compile 'com.github.gabrielemariotti.recyclerview:recyclerview-animators:0.3.0-SNAPSHOT#aar'
compile 'com.tiancaicc.springfloatingactionmenu:library:0.0.2'
compile 'com.daimajia.numberprogressbar:library:1.2#aar'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.daprlabs.aaron:cardstack:0.3.0'
compile 'com.txusballesteros:FitChart:1.0'
compile 'com.github.SilenceDut:ExpandableLayout:v1.0.1'
}
I finally got my project to run and this is how:
Apparently, It is not possible to use Jack compiler with Realm at the moment, because Jack does not support bytecode manipulation (Javassist / Transform API). That being said we can however for now use 'retrolambda' and remove jackOptions.
in your build.gradle
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'realm-android'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
in the projects main gradle add class path:
dependencies {
classpath 'io.realm:realm-gradle-plugin:0.88.3'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
}
And that got my project running again.

getting error when trying to get APK file of android project

so I was trying to generate the APK file of an android project created in Android Studio and I keep getting the following error:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/concurrent/Cancellable.class
also here's my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.example.app"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(':vitamio')
compile 'com.android.support:appcompat-v7:24.0.0-beta1'
compile 'com.google.android.gms:play-services:9.0.1'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.android.support:design:24.0.0-beta1'
compile 'com.github.natasam:DemoProgressViewsLibApp:fa2f8f01e0'
compile 'com.google.android.gms:play-services-ads:9.0.1'
compile 'com.google.android.gms:play-services-auth:9.0.1'
compile 'com.google.android.gms:play-services-gcm:9.0.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
}
So can any one please tell me how I can solve that error ? I tried removing the http in dependencies but still error. Any respond is appricated. Thanks!

android: Execution failed for task ':app:dexDebug' zxing barcode scanner

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

Categories

Resources