I am trying to add microsoft azure mobile services to my existing android app. After adding the .jar files in my folder. I am getting error:
Execution failed for task
':app:transformClassesWithJarMergingForDebug.
For various file like annotation.class, Gson$5.class and as you can see in the error file it shows ApiJsonOperationCallback.class.
I have tired a lot of things(such as ./gradlew clean and ./gradlew clean assemble) but have been running into deadends everywhere.
This is my gradle file
apply plugin: 'com.android.application'
android {compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.jino.navigationplacepicker"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
defaultConfig {
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
jcenter()
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
}
And this is the error message
:app:compileDebugNdk UP-TO-DATE :app:compileDebugSources
:app:transformClassesWithJarMergingForDebug FAILED Error:Execution
failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry:
com/microsoft/windowsazure/mobileservices/ApiJsonOperationCallback.class
:app:compileDebugJavaWithJavac Note: Some input files use or override
a deprecated API. Note: Recompile with -Xlint:deprecation for details.
Information:BUILD FAILED
Request you to please into this, and respond in layman terms as i am new to this.
The libraries are referenced twice in the gradle file causing them to conflict with each other.
The following lines are not needed.
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-javadoc.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3-sources.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/gson-2.2.2.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/guava-17.0.jar')
compile files('libs/azuresdk-android-2.0.3/mobileservices/mobileservices-2.0.3.jar')
The following line will download and reference the needed binaries for Azure Mobile Services.
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
Here is a copy of a gradle file for a working Android application.
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "19.1.0"
defaultConfig {
applicationId "com.example.yourapp"
minSdkVersion 8
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'aars'
}
}
}
dependencies {
compile 'com.google.code.gson:gson:2.3'
compile 'com.google.guava:guava:18.0'
compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.3'
}
Related
This question already has answers here:
Unable to merge dex error [duplicate]
(2 answers)
Closed 5 years ago.
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I am using version 3.0.1 of Android Studio.
I also tried 'clean project' and 'rebuild project'.
*project build gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
*module build gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.protobuf'
ext {
grpcVersion = '1.4.0'
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.backkom.speechtest"
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.2'
}
}
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.3.0'
}
plugins {
javalite {
artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0"
}
grpc {
artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
javalite {}
grpc {
// Options added to --grpc_out
option 'lite'
}
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
// gRPC
compile "io.grpc:grpc-okhttp:$grpcVersion"
compile "io.grpc:grpc-protobuf-lite:$grpcVersion"
compile "io.grpc:grpc-stub:$grpcVersion"
compile 'javax.annotation:javax.annotation-api:1.2'
protobuf 'com.google.protobuf:protobuf-java:3.3.1'
compile group: 'com.google.api.grpc', name: 'grpc-google-cloud-speech-v1', version: '0.1.13'
// OAuth2 for Google API
compile('com.google.auth:google-auth-library-oauth2-http:0.7.0') {
exclude module: 'httpclient'
}
compile 'com.android.support:multidex:1.0.2'
}
When I do a rebuild project, I get an error like below.
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. java.io.IOException: Can't write [C:\Users\backkom\AndroidStudioProjects\SpeechTest\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\backkom.gradle\caches\modules-2\files-2.1\com.google.protobuf\protobuf-java\3.3.1\e8964a2667e55d11a4505b329a4c34247663920b\protobuf-java-3.3.1.jar(;;;;;;**.class)] (Duplicate zip entry [protobuf-java-3.3.1.jar:com/google/protobuf/ExperimentalApi.class]))
From your error log it seems like your directory backkom is not available for android studio . so please check your directory
C:\Users\backkom
is writable or not . by doing so . go to that directory and check its permission . is it has read and write both permission or not .
As per my understanding,
Try this :
Clean Project button.
Rebuild Project button from the Build menu.
And change your local.properties with this
org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m
And define gradle in this way
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.xxxx.xxxx"
minSdkVersion 21
targetSdkVersion 26
versionCode 7
versionName "0.7"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
And add this multidex in your project
compile 'com.android.support:multidex:1.0.1'
and Define it in Manifest
I have already applied possible solution given on SO ,but no luck .
Just transform my existing eclispe project in to studio and stuck at this point .
getting this error :
Error:Execution failed for task ':xxx:mergeDebugResources'.
Some file crunching failed
and this warning too,
libpng warning: iCCP: Not recognizing known sRGB profile that has been edited
Below are the solutions I already tried ,
1>Some file crunching failed
2> check out all image names for their proper extension
3> clean and rebuild the project so many times :/
Here is build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "XXXXXXXXXXX"
minSdkVersion 15
targetSdkVersion 22
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
compile project(':main1')
compile project(':main')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:+'
compile files('libs/analytics-1.2.jar')
compile files('libs/classes.jar')
compile files('libs/commons-httpclient-3.1.jar')
compile files('libs/google-http-client-android2-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/httpclient-cache-4.2.5.jar')
compile files('libs/httpcore.jar')
compile files('libs/libGoogleAnalyticsServices.jar')
compile files('libs/pinchzoom.jar')
compile files('libs/universal-image-loader-1.6.1-with-src.jar')
compile files('libs/volley.jar')
}
and this is class path :
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
can any one please figure out where I'm wrong !!, any suggestion will acceptable.
Thanks in advance .
I have downloaded signalr client library from https://github.com/SignalR/java-client. On build it generated jar files.
When I add the jar files to my project, the project builds but when I try to run I get the error message below:
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 1
Previously I followed the tutorial on https://whathecode.wordpress.com/2014/03/20/getting-started-with-the-java-signalr-sdk/ and downloaded jar files from https://www.mediafire.com/?8qun6hbs3onnbbl. Those jar files were working fine.
However I needed the WebSocket transport protocol which were implemented in the latest version.
I am not sure if removal of previous jar files causing any issues.
Gradle scripts:
signalr-client-sdk
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.2'
compile 'org.java-websocket:java-websocket:1.3.1'
}
-signalr-client-sdk-android
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile project(':signalr-client-sdk')
}
-My project
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.eb5.uvexa.uvexadriver"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions
{
preDexLibraries=false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/gson-2.2.2.jar')
compile files('libs/mail.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/signalr-client-sdk.jar')
compile files('libs/signalr-client-sdk-android.jar')
}
I tried clean and rebuild, restarted the pc and also Invalidate option in Android Studio.
I am using windows10 and Android Studio(64). What am I doing wrong?
My 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_20\bin\java.exe'' finished with non-zero exit value 2
I have zero clue where this is coming from. I'm trying to integrate Stripe so possibly it could be a gradle issue.
Stripe is a external library integrated.
App build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.weaverprojects.stripe2"
minSdkVersion 21
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'])
compile project(':stripe')
//compile 'com.android.support:support-v4:18.0.+'
compile 'com.google.code.gson:gson:2.3'
compile 'org.parceler:parceler:0.2.13'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup:otto:1.3.6'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
}
Stripe library build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 21
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'])
compile 'com.stripe:stripe-java:1.15.1'
//compile 'com.google.code.gson:gson:2.2.4'
}
Top level build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Settings.gradle:
include ':app', ':stripe'
I had your problem right now, I solved it checking the dependencies ( I had one library with different version of the same dependence) and rebuild the project.
Check also this answer.
So try:
1- Check dependecies and resolve the different versions or conflicts of the same library/dependence
2- Resync Gradle
3- Rebuild the project (this was essential for me)
Sometimes it seems that the problem is caused by the exhaustion of RAM memory (a lot of program opened or android emulator)
I'm facing a problem with my dependencies in my app that will not let me add my endpoints-backend module as a dependency to my app module like so:
When I compile, it gives me this error:
Error:Execution failed for task ':app:preDexDebug'. >com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
When I remove the endpoints-backend dependency, the program runs, but I need it as a dependency so I can access the endpoints code inside my MainActivity.
Here's my Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.blume.android"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile project(path: ':endpoints-backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile project(path: ':cloud-backend', configuration: 'android-endpoints')
compile 'javax.persistence:persistence-api:1.0'
compile project(':endpoints-backend')
}
All Help is appreciated!
You should remove this line:
compile project(':endpoints-backend')
You have it included here:
compile project(path: ':endpoints-backend', configuration: 'android-endpoints')