how i can resolve Error while merging dex archives? - android

Im getting this error in Build panel :
* What went wrong:
Execution failed for task ':app:mergeExtDexDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: com.parse.AbstractQueryController$1
after adding this library implementation 'com.parse:parse-livequery-android:1.0.6' to my existing implementations that they were these :
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'com.google.android.gms:play-services:11.4.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
//image_view_cornered_lib
implementation 'com.github.siyamed:android-shape-imageview:0.9.3#aar'
//circle image view lib
implementation 'de.hdodenhof:circleimageview:2.2.0'
//parse libs here
implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.19.0'
implementation 'com.github.parse-community.Parse-SDK-Android:fcm:1.19.0'
implementation 'com.github.parse-community.Parse-SDK-Android:ktx:1.19.0'

Did you try this:
in app/build.gradle:
android {
defaultConfig {
multiDexEnabled true
}
}

com.parse.AbstractQueryController module is used by multiple library
in your case it must be
com.parse:parse-livequery-android:1.0.6 and com.github.parse-community.Parse-SDK-Android:parse:1.19.0
To find the list of dependencies for the module app (default module's name for the app) we can do a
gradlew app:dependencies
to retrieve a list of all the libraries.
after you found module that used twice with different versions exclude it like this
implementation ('com.parse:parse-livequery-android:1.0.6') {
exclude module: 'duplicated module'
}

Related

How to install "Cloud Text-To-Speech" with Gradle?

I would like to use Cloud Text-To-Speech.
On the documentation page I see that I have to install the client library. On that page you see the code for Maven but in my Android Studio, I am using Gradle and I have no idea how to install it with Gradle.
On MVNRepository I have noticed that I have to use compile group: 'com.google.cloud', name: 'google-cloud-texttospeech', version: '1.2.1'. So on on my application (app -> build.gradle), I have inserted that line to the dependencies. So it looks like this:
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
compile group: 'com.google.cloud', name: 'google-cloud-texttospeech', version: '1.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
But that gives me the error: More than one file was found with OS independent path 'META-INF/INDEX.LIST'.
Also, Android Studio tells me "compile is deprecated; replace with implementation". If I replace it, I'll get the error: Cannot fit requested classes in a single dex file (# methods: 151443 > 65536)
I also tried to use:
packagingOptions {
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/DEPENDENCIES'
}
I cleaned my project and restarted the app but then I get the error: Cannot fit requested classes in a single dex file (# methods: 147675 > 65536)
This is too annoying! How can I simply install that library??
Instead of compile group: 'com.google.cloud', name: 'google-cloud-texttospeech', version: '1.2.1', I needed to use implementation 'com.google.cloud:libraries-bom:4.3.0'.

Program type already present: android.support.v4

i am trying to build my react native project on android but i got this error message.
i tryed to fixe libraries dependency but does not work.i found a post that suggest to exclude "android.support.v4.app ..". but don't really know how to handle that any idea
this is package i load
dependencies {
implementation project(':react-native-fs')
implementation project(':react-native-image-resizer')
implementation project(':react-native-image-picker')
implementation project(':react-native-device-info')
implementation project(':react-native-restart')
implementation project(':react-native-svg')
implementation project(':react-native-cardview')
implementation project(':react-native-vector-icons')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation 'com.facebook.react:react-native:+'
}
this is the result
" com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Learn how to resolve the issue at.
Program type already present: android.support.v4.app.INotificationSideChannel
"

Program type already present: org.tensorflow.Graph$Reference

I updated my Android Studio to 3.1.2, my app gradle looks as follows:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
implementation 'org.tensorflow:tensorflow-android:1.8.0-rc0'
}
Trying to build gives me following error:
AGPBI: {"kind":"error","text":"Program type already present: org.tensorflow.Graph$Reference","sources":[{}],"tool":"D8"}
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:...
If someone could give me a hint where to search or how to fix would be really appreciated. I tried updating tensorflow to 1.8.0-rc1, didn't change a thing.
Check if there is a libandroid_tensorflow_inference_java.jar or other similar name in your project, which would conflict with your setting, "implementation 'org.tensorflow:tensorflow-android:1.x.x'"
Just delete the jar file, and works for me.

Gradle Unable to resolve dependency for ':app#debug/compileClasspath':

Per the documentation on GitHub my build.gradle(app) is:
repositories {
jcenter()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
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'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.dubsmash.volley:library:2.0.1'
compile 'ca.mimic:oauth2library:2.3.0'
compile 'com.github.kittinunf.fuel:fuel:<latest-version>' //for JVM
compile 'com.github.kittinunf.fuel:fuel-android:<latest-version>' //for Android
compile 'com.github.kittinunf.fuel:fuel-livedata:<latest-version>' //for LiveData support
compile 'com.github.kittinunf.fuel:fuel-rxjava:<latest-version>' //for RxJava support
compile 'com.github.kittinunf.fuel:fuel-gson:<latest-version>' //for Gson support
compile 'com.github.kittinunf.fuel:fuel-jackson:<latest-version>' //for Jackson support
}
And when I try to build Gradle throws the following error for all the fuel components:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.kittinunf.fuel:fuel-livedata:<latest-version>.
Could not resolve com.github.kittinunf.fuel:fuel-livedata:<latest-version>.
Required by:
project :app
> No cached version of com.github.kittinunf.fuel:fuel-livedata:<latest-version> available for offline mode.
You can't actually write "<latest-version>" in a gradle compile block.
You have to substitute it for the version number.
So it'd be something like:
compile 'com.github.kittinunf.fuel:fuel:2.2.0'
Again, substitute the version number for the version you want.

Cannot build APK - DexException

When I'm building my project by "Run (applicaton)" build-in function - everything's fine, I can test my app through phone, but I want to create standalone application by gradle.
I'm using gradle :client:clean :client:assemble task, and that's my output:
Dex: Error converting bytecode to dex:sesWithDexForDebug
Cause: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
By this link I've searched for some dependencies between my modules. I checked, that appcompat-v7 and design library have support-v4 library build-in, so I removed it from design library.
My build.gradle file:
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'
})
//Support Design
compile ('com.android.support:appcompat-v7:23.4.0')
compile ('com.android.support:design:23.4.0') {
exclude module: 'support-v4'
}
//Butter Knife
compile 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
//Retrofit
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//JSON Utils
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
//Dagger 2
compile 'com.google.dagger:dagger:2.9'
annotationProcessor 'com.google.dagger:dagger-compiler:2.9'
provided 'javax.annotation:jsr250-api:1.0'
//Android Plot
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
//Apache Commons
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
//RxJava
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
//Tests
testCompile 'junit:junit:4.12'
}
How can I fix it?
Regards
EDIT
I added multiDexEnabled true, and it gaves me another error:
Error:Execution failed for task ':client:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/hardware/display/DisplayManagerCompat$JellybeanMr1Impl.class
When your app has over 64k methods, you must enable Multidex. Usually this happens when a large number of libraries are used.
To get around this, enable Multidex in your build.gradle
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 25
multiDexEnabled true
}
...
}
Read more about Multidex here.
Just change this attribute
multiDexEnabled false to multiDexEnabled true

Categories

Resources