I am importing eclipse project, and project has some libraries like googleplay service, google uri auth and parse. Now I am importing an eclipse project in android studio but I am facing an error. I had tried cleaning the project and all the things that is required but I didn't get the reply. Below is my error:
Error:Execution failed for task ':weddinhHall:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command
'C:\Program Files (x86)\Java\jdk1.7.0\bin\java.exe'' finished with
non-zero exit value 2
and my build.gradle file is like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.xxx.xxxxxx.main"
minSdkVersion 14
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':parallaxScroll')
compile project(':googleDateTimePickers')
compile 'com.google.android.gms:play-services:+'
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/google-oauth-client-1.10.1-beta.jar')
compile files('libs/google-play-services.jar')
compile files('libs/Parse-1.5.0.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
}
Has anyone met this issue before?
Please remove compile files('libs/google-play-services.jar') . dexDebug occurs when duplicate entry happen . You already initialize google play service compile 'com.google.android.gms:play-services:+'.
FYI: Please use latest google play service version , like compile 'com.google.android.gms:play-services:5.0.89'
Related
I'm working on my very first android application which is almost complete now and ready to post on play store. But I'm unable to make the APK file :(
I'm using Android Studio 3.0.1
gradle-4.1
When I tried to make the APK file I got the error:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
which was quickly resolved by adding multiDexEnabled true to
app/build.gradle
file. But after adding this I'm now getting another error:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> java.io.IOException: Can't write [D:\My Data\Android\1stApplicationTest\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [C:\Users\USER_NAME\.gradle\caches\transforms-1\files-1.1\support-media-compat-26.0.2.aar\d7c069de85684fc017734fd1ac5ba973\jars\classes.jar(;;;;;;**.class)] (Duplicate zip entry [classes.jar:android/support/v4/media/VolumeProviderCompat.class]))
I'm unable to resolve this issue I tried number of solutions
updated all the jars version as per build/sdk version of the application
Removed duplicate/extra dependencies, if any
Removed Build folders from root and inside of app folder
In Android Studio File -> Invalidate Caches/Restart
Restarted Android studio with the clean build, also removed extra jars in .idea folder
Please advise if i need to remvoe something from the SDK: C:\Users\USER_NAME\AppData\Local\Android\sdk
Here is app/build.gradle file of my application
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId 'Shah.Jee'
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:26.0.2'
/*
compile files('libs/android-support-v4.jar')
compile 'com.android.support:support-v4:26.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.0.2'*/
compile 'commons-lang:commons-lang:2.6'
compile 'com.github.bumptech.glide:glide:4.2.0'
compile 'com.google.android.exoplayer:exoplayer:r2.4.0'
compile 'com.google.android.exoplayer:exoplayer-core:r2.4.0'
compile 'com.google.android.exoplayer:exoplayer-dash:r2.4.0'
compile 'com.google.android.exoplayer:exoplayer-hls:r2.4.0'
compile 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.0'
compile 'com.google.android.exoplayer:exoplayer-ui:r2.4.0'
testCompile 'junit:junit:4.12'
compile project(':picasso-2.5.2')
}
Need a quick advise if I'm missing something. Thanks in advance.
I cloned a project from github, and I have the following error in the Build: Failed to find Build Tools revision 24.0.0 rc4. This is the build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '24.0.0 rc4'
defaultConfig {
applicationId "com.project02.projects"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
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:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.google.android.gms:play-services:9.0.1'
compile 'com.google.android.gms:play-services-ads:9.0.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha1'
compile 'com.android.support:support-v4:23.4.0'
}
I have In File->Project Structere -> Build Tools Revision -> 24.0.0 rc4. And in the SDK directory the folder is 24.0.0-rc4.
I tried to change to 23.0.2, but with that I obtain this errors in the Run: **Error:The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at
https://developer.android.com/tools/building/multidex.html** and
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
The error you're getting is because you're overriding the previous built tool with the new one that doesn't exist in your built-tools folder.
Make sure you download the intended built tool from the SDK manager and then configure the gradle file appropiately. Check and see if that works.
It works for me.
I run "./gradlew build" on commandline and change buildToolVersion "24".
While the command is running, the SDK will be installed and everything goes OK.
I am getting this error when I try to build my project.
Error:(3, 5) No resource found that matches the given name (at 'cardBackgroundColor' with value '?android:attr/colorBackgroundFloating').
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Home\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1
And when I click on it it takes me to the v-23 values file of generated folder which contains following code.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CardView" parent="Base.CardView">
<item name="cardBackgroundColor">?android:attr/colorBackgroundFloating</item>
</style>
</resources>
This is my app gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion '23.0.2'
defaultConfig {
applicationId "com.xxxx"
minSdkVersion 19
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:design:22.2.1'
compile 'com.commit451:inkpageindicator:1.0.2'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'ch.acra:acra:4.5.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.code.gson:gson:2.6.2'
}
And when I change everything in gradle to version 23 this error goes away but as I am using http libraries and they are removed from 23 version therefore I am forced to use 22 version. My project was working perfectly fine before and at a sudden it started giving this error. Only thing I done was install a support repository which I was using in other project and it start giving error in this project too.
Any way to resolve this error?
compile 'com.facebook.android:facebook-android-sdk:4.+'
needs V-23
In my case I use v-22 so
i changed Facebook sdk version to 4.8
compile 'com.facebook.android:facebook-android-sdk:4.8.0'
That error makes perfect sense, seeing as ?android:attr/colorBackgroundFloating
was only added in API 23 and you are using compileSdkVersion 22.
So, to fix the error, you need compileSdkVersion 23 to include that resource in your build. Also, having a v23 values file doesn't make sense when you have targetSdkVersion 22, which says you aren't targeting v23 devices anyways.
And you mentioned the "http libraries" you are using are gone? If you are referring to HttpClient from the org.apache package, then you can add it back by including this in your build.grade
android {
useLibrary 'org.apache.http.legacy'
}
if you dont want to upgrade your modules,in addition solution is excluding modules in build.gradle with compile tag
compile( 'com.facebook.android:facebook-android-sdk:4.11.0')
{
exclude module: 'cardview-v7'
}
Sorry if I asked a duplicate question, but I couldn't find a solution for this error. I surfed around stackoverflow,gradle site, android blogs, google search but there wasn't a working solution for several hours. I'm an android beginner so I not sure if I have missed something in other posts.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:22.2.1.'
compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile 'com.android.support:recyclerview-v7:22.2.1.'
compile 'com.android.support:cardview-v7:22.2.1.'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.pnikosis:materialish-progress:1.7'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile files('libs/android-support-v4-22.2.1.jar')
compile files('libs/applovin-sdk-6.0.1.jar')
compile files('libs/appodeal-1.13.1.jar')
compile files('libs/chartboost-5.2.0.jar')
compile files('libs/my-target-4.0.13.jar')
compile files('libs/unity-ads-1.4.7.jar')
}
The project was working fine until I add some libs from appodeal (those compile file lines). I have tried to build the project but gradle gave the errors.
:app:transformClassesWithJarMergingForDebug'.
com.android.build.transform.api.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/widget/RecyclerView$ItemDecoration.class
There are also 2 more error of the same exception about duplicate entry- not sure why I got them: android/support/v4/PrintKitKat.class and android/support/multidex/MultiDex$V14.class.
I tried to upgrade gradle, invalidate and restart to clear cache, omit dependencies then rebuild/clean project, find potential duplicate module to exclude, and search projects for those .class but I found no duplication.
You can test putting this on root of directory in the Terminal
./gradlew clean
Here is the Gradle build error
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:
Process 'command 'C:\Users\Srecko\AppData\Local\Android\sdk\build-tools\21.0.2\aapt.exe''
finished with non-zero exit value 1
Everything was OK a day before, and on my notebook is still OK if I copy code.
I reinstall Windows :D and Android Studio, but problem is still here
Gradle is:
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
applicationId "com.spirit.dukomplinalpha"
minSdkVersion 14
targetSdkVersion 21
versionCode 5
versionName "1.0.5"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'org.lucasr.dspec:dspec:0.1.1'
// YOUR OTHER DEPENDENCIES
compile 'com.afollestad:material-dialogs:0.7.7.0' // material dialog
compile 'com.github.navasmdc:MaterialDesign:1.+#aar' // material buttons and stuff
compile files('libs/zbar.jar')
compile files('libs/sjxp-2.0.jar')
}
In Fragments error is:
Cannot resolve Symbol 'R'
any ideas how to solve this problem, where is the real error?
thx
better to check this all case for your project.
because there are many possible cases for this issue.
Maybe you could setting compileSdkVersion and others to the latest. And than find the comfort picture to match the ui version, click build->rebuild, maybe could solve !!