bootap
December 6, 2015, 9:11pm
1
I'm having and issue when I install the Cloud SDK in Android Studio. I'm adding the following line to my build.gradle file:
compile 'io.particle:cloudsdk:0.3.0'
When I add this to the Grade file and sync, it generates the following error:
Warning:Conflict with dependency 'org.hamcrest:hamcrest-core'. Resolved versions for app (1.1) and test app (1.3) differ.
The thing is that I don't have any "hamcrest" dependencies in my build.gradle file. Below is all of the code in the Gradle file. Everything here is what was automatically generated when I created a new Android project. I only added the "compile" line above.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.sncrmck.temptest"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
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 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'io.particle:cloudsdk:0.3.0'
}
Does anyone have an idea why this is happening or how I can fix it?
jensck
December 7, 2015, 3:59pm
2
What’s the output of running gradlew :yourmodule:dependencies
?
bootap
December 8, 2015, 3:34pm
3
Here's the output. I see there are different versions in the Cloud SDK and junit:junit:4.12 but I have no idea which to change or how to do that.
------------------------------------------------------------
Project :app
------------------------------------------------------------
_debugAndroidTestApk - ## Internal use, do not manually configure ##
No dependencies
_debugAndroidTestCompile - ## Internal use, do not manually configure ##
No dependencies
_debugApk - ## Internal use, do not manually configure ##
+--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:support-v4:23.1.1
| \--- com.android.support:support-annotations:23.1.1
\--- io.particle:cloudsdk:0.3.0
+--- com.squareup.okio:okio:1.6.0
+--- com.android.support:support-v4:23.1.1 (*)
+--- com.google.guava:guava:18.0
+--- org.apache.commons:commons-lang3:3.3.2
+--- com.google.code.gson:gson:2.3.1
+--- org.kaazing:gateway.client.java:5.1.0.4
| +--- org.kaazing:gateway.client.java.transport:5.1.0.4
| | \--- org.jmock:jmock-junit4:2.6.0
| | +--- org.jmock:jmock:2.6.0
| | | +--- org.hamcrest:hamcrest-core:1.1
| | | \--- org.hamcrest:hamcrest-library:1.1
| | | \--- org.hamcrest:hamcrest-core:1.1
| | \--- junit:junit-dep:4.4
| \--- org.kaazing:net.api:5.1.0.4
+--- net.danlew:android.joda:2.9.0
| \--- joda-time:joda-time:2.9
+--- com.squareup.okhttp:okhttp:2.5.0
| \--- com.squareup.okio:okio:1.6.0
\--- com.squareup.retrofit:retrofit:1.9.0
\--- com.google.code.gson:gson:2.3.1
_debugCompile - ## Internal use, do not manually configure ##
+--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:support-v4:23.1.1
| \--- com.android.support:support-annotations:23.1.1
\--- io.particle:cloudsdk:0.3.0
+--- com.squareup.okio:okio:1.6.0
+--- com.android.support:support-v4:23.1.1 (*)
+--- com.google.guava:guava:18.0
+--- org.apache.commons:commons-lang3:3.3.2
+--- com.google.code.gson:gson:2.3.1
+--- org.kaazing:gateway.client.java:5.1.0.4
| +--- org.kaazing:gateway.client.java.transport:5.1.0.4
| | \--- org.jmock:jmock-junit4:2.6.0
| | +--- org.jmock:jmock:2.6.0
| | | +--- org.hamcrest:hamcrest-core:1.1
| | | \--- org.hamcrest:hamcrest-library:1.1
| | | \--- org.hamcrest:hamcrest-core:1.1
| | \--- junit:junit-dep:4.4
| \--- org.kaazing:net.api:5.1.0.4
+--- net.danlew:android.joda:2.9.0
| \--- joda-time:joda-time:2.9
+--- com.squareup.okhttp:okhttp:2.5.0
| \--- com.squareup.okio:okio:1.6.0
\--- com.squareup.retrofit:retrofit:1.9.0
\--- com.google.code.gson:gson:2.3.1
_debugUnitTestApk - ## Internal use, do not manually configure ##
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
_debugUnitTestCompile - ## Internal use, do not manually configure ##
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
_releaseApk - ## Internal use, do not manually configure ##
+--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:support-v4:23.1.1
| \--- com.android.support:support-annotations:23.1.1
\--- io.particle:cloudsdk:0.3.0
+--- com.squareup.okio:okio:1.6.0
+--- com.android.support:support-v4:23.1.1 (*)
+--- com.google.guava:guava:18.0
+--- org.apache.commons:commons-lang3:3.3.2
+--- com.google.code.gson:gson:2.3.1
+--- org.kaazing:gateway.client.java:5.1.0.4
| +--- org.kaazing:gateway.client.java.transport:5.1.0.4
| | \--- org.jmock:jmock-junit4:2.6.0
| | +--- org.jmock:jmock:2.6.0
| | | +--- org.hamcrest:hamcrest-core:1.1
| | | \--- org.hamcrest:hamcrest-library:1.1
| | | \--- org.hamcrest:hamcrest-core:1.1
| | \--- junit:junit-dep:4.4
| \--- org.kaazing:net.api:5.1.0.4
+--- net.danlew:android.joda:2.9.0
| \--- joda-time:joda-time:2.9
+--- com.squareup.okhttp:okhttp:2.5.0
| \--- com.squareup.okio:okio:1.6.0
\--- com.squareup.retrofit:retrofit:1.9.0
\--- com.google.code.gson:gson:2.3.1
_releaseCompile - ## Internal use, do not manually configure ##
+--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:support-v4:23.1.1
| \--- com.android.support:support-annotations:23.1.1
\--- io.particle:cloudsdk:0.3.0
+--- com.squareup.okio:okio:1.6.0
+--- com.android.support:support-v4:23.1.1 (*)
+--- com.google.guava:guava:18.0
+--- org.apache.commons:commons-lang3:3.3.2
+--- com.google.code.gson:gson:2.3.1
+--- org.kaazing:gateway.client.java:5.1.0.4
| +--- org.kaazing:gateway.client.java.transport:5.1.0.4
| | \--- org.jmock:jmock-junit4:2.6.0
| | +--- org.jmock:jmock:2.6.0
| | | +--- org.hamcrest:hamcrest-core:1.1
| | | \--- org.hamcrest:hamcrest-library:1.1
| | | \--- org.hamcrest:hamcrest-core:1.1
| | \--- junit:junit-dep:4.4
| \--- org.kaazing:net.api:5.1.0.4
+--- net.danlew:android.joda:2.9.0
| \--- joda-time:joda-time:2.9
+--- com.squareup.okhttp:okhttp:2.5.0
| \--- com.squareup.okio:okio:1.6.0
\--- com.squareup.retrofit:retrofit:1.9.0
\--- com.google.code.gson:gson:2.3.1
_releaseUnitTestApk - ## Internal use, do not manually configure ##
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
_releaseUnitTestCompile - ## Internal use, do not manually configure ##
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
androidJacocoAgent - The Jacoco agent to use to get coverage data.
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.agent/0.7.4.201502262128/org.jacoco.agent-0.7.4.201502262128.pom
\--- org.jacoco:org.jacoco.agent:0.7.4.201502262128
androidJacocoAnt - The Jacoco ant tasks to use to get execute Gradle tasks.
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.ant/0.7.4.201502262128/org.jacoco.ant-0.7.4.201502262128.pom
Download https://jcenter.bintray.com/org/jacoco/org.jacoco.report/0.7.4.201502262128/org.jacoco.report-0.7.4.201502262128.pom
\--- org.jacoco:org.jacoco.ant:0.7.4.201502262128
+--- org.jacoco:org.jacoco.core:0.7.4.201502262128
| \--- org.ow2.asm:asm-debug-all:5.0.1
+--- org.jacoco:org.jacoco.report:0.7.4.201502262128
| +--- org.jacoco:org.jacoco.core:0.7.4.201502262128 (*)
| \--- org.ow2.asm:asm-debug-all:5.0.1
\--- org.jacoco:org.jacoco.agent:0.7.4.201502262128
androidTestApk - Classpath packaged with the compiled 'androidTest' classes.
No dependencies
androidTestCompile - Classpath for compiling the androidTest sources.
No dependencies
androidTestProvided - Classpath for only compiling the androidTest sources.
No dependencies
androidTestWearApp - Link to a wear app to embed for object 'androidTest'.
No dependencies
apk - Classpath packaged with the compiled 'main' classes.
No dependencies
archives - Configuration for archive artifacts.
No dependencies
compile - Classpath for compiling the main sources.
+--- com.android.support:appcompat-v7:23.1.1
| \--- com.android.support:support-v4:23.1.1
| \--- com.android.support:support-annotations:23.1.1
\--- io.particle:cloudsdk:0.3.0
+--- com.squareup.okio:okio:1.6.0
+--- com.android.support:support-v4:23.1.1 (*)
+--- com.google.guava:guava:18.0
+--- org.apache.commons:commons-lang3:3.3.2
+--- com.google.code.gson:gson:2.3.1
+--- org.kaazing:gateway.client.java:5.1.0.4
| +--- org.kaazing:gateway.client.java.transport:5.1.0.4
| | \--- org.jmock:jmock-junit4:2.6.0
| | +--- org.jmock:jmock:2.6.0
| | | +--- org.hamcrest:hamcrest-core:1.1
| | | \--- org.hamcrest:hamcrest-library:1.1
| | | \--- org.hamcrest:hamcrest-core:1.1
| | \--- junit:junit-dep:4.4
| \--- org.kaazing:net.api:5.1.0.4
+--- net.danlew:android.joda:2.9.0
| \--- joda-time:joda-time:2.9
+--- com.squareup.okhttp:okhttp:2.5.0
| \--- com.squareup.okio:okio:1.6.0
\--- com.squareup.retrofit:retrofit:1.9.0
\--- com.google.code.gson:gson:2.3.1
debugApk - Classpath packaged with the compiled 'debug' classes.
No dependencies
debugCompile - Classpath for compiling the debug sources.
No dependencies
debugProvided - Classpath for only compiling the debug sources.
No dependencies
debugWearApp - Link to a wear app to embed for object 'debug'.
No dependencies
default - Configuration for default artifacts.
No dependencies
default-mapping - Configuration for default mapping artifacts.
No dependencies
default-metadata - Metadata for the produced APKs.
No dependencies
provided - Classpath for only compiling the main sources.
No dependencies
releaseApk - Classpath packaged with the compiled 'release' classes.
No dependencies
releaseCompile - Classpath for compiling the release sources.
No dependencies
releaseProvided - Classpath for only compiling the release sources.
No dependencies
releaseWearApp - Link to a wear app to embed for object 'release'.
No dependencies
testApk - Classpath packaged with the compiled 'test' classes.
No dependencies
testCompile - Classpath for compiling the test sources.
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testDebugApk - Classpath packaged with the compiled 'testDebug' classes.
No dependencies
testDebugCompile - Classpath for compiling the testDebug sources.
No dependencies
testDebugProvided - Classpath for only compiling the testDebug sources.
No dependencies
testDebugWearApp - Link to a wear app to embed for object 'testDebug'.
No dependencies
testProvided - Classpath for only compiling the test sources.
No dependencies
testReleaseApk - Classpath packaged with the compiled 'testRelease' classes.
No dependencies
testReleaseCompile - Classpath for compiling the testRelease sources.
No dependencies
testReleaseProvided - Classpath for only compiling the testRelease sources.
No dependencies
testReleaseWearApp - Link to a wear app to embed for object 'testRelease'.
No dependencies
testWearApp - Link to a wear app to embed for object 'test'.
No dependencies
wearApp - Link to a wear app to embed for object 'main'.
No dependencies
BUILD SUCCESSFUL
Total time: 10.74 secs
jensck
December 8, 2015, 6:00pm
4
OK, I see what’s happening.
I’m going to try out a couple things at the SDK level to try to fix this for everyone who might run into this.
In the meantime, you can temporarily fix this by just commenting out the testCompile 'junit:junit:4.12'
line in your build.gradle. (This will obviously kill your unit tests, but it will get you working again for now.)
Thanks for the info!
bootap
December 8, 2015, 11:36pm
5
Thanks for the help jensck!!!
Dilbert
December 14, 2015, 8:05pm
6
Hi @jensck ,
I tried commented out the junit line. But I still have following error, any suggestions ?
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/kaazing/gateway/client/transport/Event;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:579)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:517)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:164)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
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_65\bin\java.exe'' finished with non-zero exit value 2
Hi ,
I had the same problem, after commenting the line " testCompile ’ junit : junit : 4.12 " apparently the problem was solved . After trying to run the application on an Android device the following error was presented:
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_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
Try on a completely new project including as dependencies :
dependencies {
compile FileTree ( dir: ' libs ' , include: [ '* .jar '])
compile ' com.android.support:appcompat-v7:23.1.1 '
compile ' com.android.support:design:23.1.1 '
compile ' io.particle : cloudsdk : 0.3.0 '
}
and the error is repeated again. After many attempts to rebuild and clean the grade file the problem persists, I do not see any repeat library …
Does anyone have an idea how I can fix it?
Thank you
Mesut
December 18, 2015, 9:05am
8
Hello,
i have the same issue.
I created an new Project and only added compile 'io.particle:cloudsdk:0.3.0' to the app gradle file.
After trying to run the application on an Android device the following error was presented:
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_65.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
Information:BUILD FAILED
I would be very pleased if anyone has a solution for this problem.
Thank you
jensck
December 30, 2015, 2:11am
9
Sorry to hear you were having trouble. Updating to the 0.3.1
release of the cloud SDK (and the 0.3.3
release of the device setup lib, if you use that) resolves this.
juchow
March 21, 2016, 3:12am
10
Hello Jens,
I am getting the same error “finished with non-zero exit value 2” as above, when trying to compile 0.3.4. I tried 0.3.3 and still same result. Please advise.
jensck
March 22, 2016, 3:38am
11
“finished with non-zero exit value 2” is a generic error that just says “it failed”. Do you have any more specific error output?
juchow
March 22, 2016, 3:08pm
12
After some googling, I first added
dexOptions {
javaMaxHeapSize “4g”
}
to my build.gradle. Then it gave another error, and then I added this as well:
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
No more errors for now… is this an acceptable way to handle them? Will try to see if I can get login code working using Particle Cloud SDK now.