Transform Exception thrown even when multidexEnabled - java

I am trying to build a release version of my app in Android Studio, and no matter what I try I get the error message:
Execution failed for task
'app:transformClassesWithJarMergingForRelease'. >
com.android.build.api.transform.TransformException:
java.util.zip.ZipException: duplicate entry:
com/android/volley/Request$Priority.class.
I've enabled multidex, cleaned and rebuilt my app, and nothing is working.
The following is my gradle build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "carter.streakly"
minSdkVersion 19
targetSdkVersion 24
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 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
compile 'com.google.android.gms:play-services-appindexing:8.1.0'
compile 'com.google.android.gms:play-services:9.2.1'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.volley:volley:1.0.0'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.android.support:support-v4:24.0.0'
compile 'com.android.support:multidex:1.0.0'
}

In build.gradle dependencies you included two libraries:
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.volley:volley:1.0.0'
wherecom.mcxiaoke.volley is basically a fork of official Google library, so you should use only one of them. Please also note, that according to the mcxiaoke/android-volley READ.ME :
(...) this project is deprecated and no longer being maintained, please use official version from jCenter.
compile 'com.android.volley:volley:1.0.0'

Related

I m Using volleyplus and volley libraries in Signal android project

android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "testing.gps_service"
minSdkVersion 11
targetSdkVersion 22
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:23.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'dev.dworks.libs:volleyplus:+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories
{
mavenCentral()
google()
}
apply plugin: 'kotlin-android-extensions'
-------------------------------------------------------
## I'm new to Android, currently working on FYP, as I run my project, an
error is occurred.##
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Compile with
compile 'dev.dworks.libs:volleyplus:0.1.4'
hope that will help
Use this Link for Upload Image "https://www.simplifiedcoding.net/android-upload-image-to-server/"

Problem authenticating with gmail on Android

Cannot authenticate with Google on Android. Android Studio shows these errors:
The following classes could not be instantiated:
com.google.android.gms.common.SignInButton
Here is my XML
<com.google.android.gms.common.SignInButton
android:id="#+id/sign_in_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
and here is my app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.ramadanapp.android.firebaseuploadimage"
minSdkVersion 19
targetSdkVersion 26
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:26.0.0-alpha1'
compile 'com.google.firebase:firebase-storage:11.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-auth:11.4.0'
compile 'com.google.android.gms:play-services-auth:11.4.0'
}
apply plugin: 'com.google.gms.google-services'
Have you added dependency in build.gradle file at project level? If not then add the below dependency in that.
dependencies{
classpath 'com.google.gms:google-services:3.0.0'
...
}
i think you didn't add the dependencies of play-services-auth
Just add compile 'com.google.android.gms:play-services-auth:11.4.0' dependencies in build.gradle app file like below code
dependencies {
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.android.gms:play-services-auth:11.4.0'
}

java.lang.IllegalStateException error with Firebase Analytics

I'm using Firebase Analytics in my application and after adding that to my project I'm getting this error in logcat after application starts. I've searched for it but I found nothing to fix it and I'm not using SQLite database in my application. What is wrong?
E/System: Uncaught exception thrown by finalizer
E/System: java.lang.IllegalStateException: The database '/data/user/0/ir.aftabeshafa.shafadoc/databases/google_app_measurement_local.db' is not open.
at android.database.sqlite.SQLiteDatabase.throwIfNotOpenLocked(SQLiteDatabase.java:2185)
at android.database.sqlite.SQLiteDatabase.createSession(SQLiteDatabase.java:367)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:86)
at android.database.sqlite.SQLiteDatabase$1.initialValue(SQLiteDatabase.java:85)
at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:160)
at java.lang.ThreadLocal.get(ThreadLocal.java:150)
at android.database.sqlite.SQLiteDatabase.getThreadSession(SQLiteDatabase.java:361)
at android.database.sqlite.SQLiteProgram.getSession(SQLiteProgram.java:101)
at android.database.sqlite.SQLiteQuery.setLastStmt(SQLiteQuery.java:96)
at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:111)
at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:300)
at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:366)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:222)
at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:209)
at java.lang.Thread.run(Thread.java:761)
this is my app module gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25"
defaultConfig {
applicationId "ir.aftabeshafa.shafadoc"
minSdkVersion 16
targetSdkVersion 25
versionCode 19
versionName "1.2.2.0"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.google.firebase:firebase-core:9.8.0'
apply plugin: 'com.google.gms.google-services'
}

Error: multiple files define Lorg/json/simple/ItemList

Whenever I try to build an APK for my project, this is the error I get:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/json/simple/ItemList;
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "my.package.here"
minSdkVersion 18
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.2.0'
compile 'org.apache.clerezza.ext:org.json.simple:0.4'
compile 'com.android.support:design:23.2.0'
}
I think that means that more than one dependency defines ItemList. I know one is org.json.simple, what is the other one?
How do I properly exclude ItemList from one of them?
there's nothing in my libs folder so that's not the problem
replace this compile 'org.apache.clerezza.ext:org.json.simple:0.4'
with
compile('com.googlecode.json-simple:json-simple:1.1.1') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
the source is here: click link

Android Studio Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.

I am getting started with Parse and Facebook SDK in Android Studio. I have integrated it successfully but while running the application I am getting the following error. Can anyone please help me with this. Thanks in advance.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/parse/AbstractQueryController$1.class
Here is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.tanmaykulkarni.appname"
minSdkVersion 15
targetSdkVersion 22
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'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:22.2.0'
compile 'com.jakewharton:butterknife:6.1.0'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.parse.bolts:bolts-android:1.3.0'
compile 'com.parse:parse-android:1.12.0'
compile 'com.parse:parsefacebookutils-v4-android:1.10.4#aar'
}
You should search for AbstractQueryController to check which dependency this class includes. Then you should update you script to ensure that this class is only included once. Do it like in the following example:
testCompile('org.robolectric:robolectric:3.0') {
//exclusions due to android.jar conflict
exclude module: 'httpclient'
exclude module: 'commons-logging'
}

Categories