duplicate entry of library gradle causing application not run - android

I searched alot but not found any solution of my problem, i tried to run my app on any device and i got this error:
it's throwing an error with com.github.bumptech.glide:glide:3.5.2 ,but it's used only single time how the classes of it got duplicate i run this app before with the same dependencies with out any trouble but suddenly this error appear while i run the app.
app.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "info.androidhive.firebase"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.android.support:design:25.1.0'
compile 'com.firebaseui:firebase-ui-database:1.1.1'
compile 'com.firebaseui:firebase-ui-storage:1.1.1'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.bumptech.glide:glide:3.5.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'com.crystal:crystalrangeseekbar:1.1.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

Browse to your project's "libs" directory and remove redundant "glide.x.x" which is causing the error due to redundancy.

Try putting this line :
enforceUniquePackageName false
after buildtoolVersion in your gradle

Related

Android Studio fails to build an APK with DexIndexOverflowException

When I run my project in my phone or in the emulator, it works fine. However, when I try to build the APK, it raises an error.
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.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536
Here is my build.gradle.
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.atm_locator.cbe.cbeatmlocator"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets { debug { res.srcDirs = ['src/debug/res', 'src/debug/res/html'] } }
}
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'
})
compile 'com.android.volley:volley:1.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
compile 'com.firebase:geofire-android:2.1.2'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.android.gms:play-services-vision:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'ai.api:libai:1.6.12'
compile 'ai.api:sdk:2.0.7#aar'
compile 'com.google.code.gson:gson:2.3'
compile 'commons-io:commons-io:2.4'
testCompile 'junit:junit:4.12'
compile files('libs/httpclient-4.5.jar')
}
apply plugin: 'com.google.gms.google-services'
What the error is telling you is that you've reached the method count limit in Android. This can be solved two ways: Either you start removing dependencies or you enable multidexing. The latter can be enabled the following way:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
On Android API level >= 21 you don't need the compile dependency, as this is supported natively by ART.
You can read all about this on https://developer.android.com/studio/build/multidex
For release, I'd suggest to enable proGuard to optimize your app and automatically remove not needed code. For debug builds, to simplify debugging, as mentioned above, you can enable multidex.
For proguard, read documentation: https://developer.android.com/studio/build/shrink-code - configuration may be not straightforward

Could not find appcompat-v7.jar (com.android.support:appcompat-v7:24.1.1)

All the while my apps running smoothly with this build.gradle file.
Then, I need to display TreeView so I have to use third party library from bmelnychuk/AndroidTreeView.
When I add compile 'com.github.bmelnychuk:atv:1.2.+'into the build.gradle file, it showed this error:
Error:A problem occurred configuring project ':app'.
Could not find appcompat-v7.jar (com.android.support:appcompat-v7:24.1.1).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/24.1.1/appcompat-v7-24.1.1.jar
This is the gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.1"
defaultConfig {
applicationId "com.ada.foresight"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
// Enabled multidex support
multiDexEnabled true
}
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:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.7'
compile 'com.prolificinteractive:material-calendarview:1.4.0'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1'
compile 'com.android.support:percent:22.2.0'
compile 'com.github.satyan:sugar:1.4'
// problem occur while I added this line:
//compile 'com.github.bmelnychuk:atv:1.2.+'
}
Please help.

Android Error duplicate entry: com/google/android/gms/internal/zzai$zza.class

I am currently having some trouble running my project.
duplicate entry: com/google/android/gms/internal/zzai$zza.class
The error is saying that I have a duplicate dependency, but I can't see a duplicate anywhere!
The error appears on this line of code:
compile 'com.google.android.gms:play-services-ads:8.4.0'
It says that it has found versions 9.8 and 8.4. I only see version 8.4 though.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.tedrasoft.templategoogle"
minSdkVersion 15
targetSdkVersion 23
versionCode=7
versionName="1.6"
multiDexEnabled true
manifestPlaceholders = [manifestApplicationId : "${applicationId}",
onesignal_app_id : "ed282ffa-1e9e-4dd8-9edc-cfdcbe8376bd",
onesignal_google_project_number: "3902815545"]
}
buildTypes {
release {
lintOptions {
disable 'MissingTranslation'
}
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile files('libs/chartboost.jar')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.facebook.android:audience-network-sdk:4.+'
compile 'com.onesignal:OneSignal:2.+#aar'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'
compile files('libs/jackson-annotations-2.1.0.jar')
compile files('libs/jackson-core-2.1.0.jar')
compile files('libs/jackson-databind-2.1.0.jar')
}
In my case, it's because of the
compile 'com.facebook.android:audience-network-sdk:4.+'
I change it to this:
compile ('com.facebook.android:audience-network-sdk:4.+'){
exclude group:"com.google.android.gms"
}
No more problem!
Make these versions match... so 8.4.0, not + which pulls the latest 9.8 I think, now?
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.google.android.gms:play-services-location:+'
Also, these are 1) unneccessary lines (because of compile fileTree), and 2) you should make them like the others and not use jar files.
compile files('libs/jackson-annotations-2.1.0.jar')
compile files('libs/jackson-core-2.1.0.jar')
compile files('libs/jackson-databind-2.1.0.jar')
Upgrade google play services (maps, location and gcm) from 9.0.0 to 9.2.0
compile 'com.google.android.gms:play-services-location:9.2.0'
compile 'com.google.android.gms:play-services-maps:9.2.0'
compile 'com.google.android.gms:play-services-gcm:9.2.0'
Then add this dependency:
compile 'com.google.android.gms:play-services-places:9.2.0'

java.lang.NoClassDefFoundError: com.amazonaws.mobileconnectors.apigateway.ApiResponse

I made a few changes to my android application, and now I'm getting this. I'm thinking it might be caused by updating the autogenerated ApiGateway SDK that I'm using in my app. But maybe it's something else? I'm not even sure where to start debugging.
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.2'
defaultConfig {
applicationId "com.johndoe.supercoolsoftware"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// compile fileTree(include: ['*.jar'], dir: 'app/libs')
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:9.2.0'
compile 'com.google.android.gms:play-services-auth:9.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.14.1'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.amazonaws:aws-android-sdk-core:2.2.22'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.22'
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.2.22'
compile 'com.amazonaws:aws-android-sdk-cognito:2.2.22'
compile 'com.amazonaws:aws-android-sdk-apigateway-core:2.2.22'
compile 'com.google.code.gson:gson:2.2.4'
//used for API Gateway SDK generated classes
compile files('libs/Api-alpha-0.51.jar') #<- autogenerated SDK
}
apply plugin: 'com.google.gms.google-services'
Okay I figured it out. AWS just updated their Android core. So now when you build it's using a newer version (v2.3.2 now) where the old one was v2.22.2. Once I updated my android application to use v2.3.2 by changing my gradel file, everything worked.
compile 'com.amazonaws:aws-android-sdk-core:2.3.2'
compile 'com.amazonaws:aws-android-sdk-s3:2.3.2'
compile 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.3.2'
compile 'com.amazonaws:aws-android-sdk-cognito:2.3.2'
compile 'com.amazonaws:aws-android-sdk-apigateway-core:2.3.2'

Can't resolve the dependency

My all other dependencies are successfully being resolved except-:
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.parse:parse-android:1.+'
My build.gradle is -:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.transenigma.iskconapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
//multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.parse.bolts:bolts-android:1.2.1'
compile 'com.parse:parse-android:1.+'
compile 'joda-time:joda-time:2.9.1'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.makeramen:roundedimageview:1.5.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.nineoldandroids:library:2.4.0'
}
There is no problem in other libraries. Actually I made this project using internet without proxy and now I have changed Internet to that of proxy. although I have made changes in the settings but still these 2 dependencies are not being resolved. All other dependencies are successfully being resolved meaning that the internet is working properly. What is the issue.
You can use buildToolsVersion "23.0.1"
Use compile 'com.parse:parse-android:1.12.0' instead of yours .
Actually compile 'com.parse:parse-android:1.+' is not suitable (old ) for your dependencies & It's a Exact Version .

Categories

Resources