new to Android Studio.
I've just created a new blank app and added a new Google Cloud Module.
After adding the module I get the 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.7.0_79\bin\java.exe'' finished with non-zero exit value 2
I have read the multiple answers here on StackOverflow, all suggesting an error with gradle dependencies, however I cannot see one. Here are my two gradle files:
build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bristow.conor.intellipa"
minSdkVersion 23
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.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
compile project(path: ':backend', configuration: 'android-endpoints')
}
build.gradle (Module: backend)
// If you would like more information on the gradle-appengine-plugin please refer to the github page
// https://github.com/GoogleCloudPlatform/gradle-appengine-plugin
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile 'com.google.appengine:appengine-endpoints:1.9.18'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.googlecode.objectify:objectify:4.0b3'
compile 'com.ganyo:gcm-server:1.0.2'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
I do not see any duplicates nor am I using a '+' with the version numbers that seem to solve other peoples problems. I haven't added/modified or tinkered with the project yet bar adding the module. Prior to adding the module, it compiles correctly.
Add this line in gradle file
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
use compile 'com.google.android.gms:play-services-gcm:8.3.0'
instead of 'com.google.android.gms:play-services:8.1.0'
Related
Suddenly I could not build my projects with Android Studio by this following error. I have attached build.gradle file and SDK installation images, I have tried several hours but I could not get solved. Please help me to solve this problem.
Error:
Error:Execution failed for task ':qApp:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/node/Android/Sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/UserFormValidation.jar')
}
SDK list
Try to add this inside you gradle file:
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
.....
dexOptions {
javaMaxHeapSize "4g"
}
}
Try to add this lines in your dependencies:
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
And in the defaultConfig, use the same targetSdkVersion of the compileSdkVersion
I have added Fabric to my application from Android studio via Fabric plugin, after that I could not run my application. It shows following error while running the project.
Error message:
Error:Execution failed for task ':qApp:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1
build.gradle file after included Fabric:
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/UserFormValidation.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.5.5#aar') {
transitive = true;
}
}
It was working fine before adding Fabric, how I can resolve this issue? please help me. I am running on Ubuntu Machine.
Try to add multiDexEnabled true in your gradle file as below:
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
...
}
After that clean and rebuild your project.
It's work for me.I hope its helps you.
You app has crossed the dex limit of 65k methods so you need to enable multidex in your app.
add
compile 'com.android.support:multidex:1.0.1'
to gradle and also add multidex:true
defaultConfig {
multiDexEnabled true
}
Also extend your application class with MultiDexApplication.this and this.
*note - you might wanna remove playservices with more bifurcated version like this link explains, to avoid multidex issues.
I have imported eclipse project into android studio. When I creates new project in studio and run its working fine. But when I run imported project then I am getting below 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.7.0_80\bin\java.exe'' finished with non-zero exit value 2
Here is my bulid.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
// useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.edelivery"
minSdkVersion 11
targetSdkVersion 23
multiDexEnabled true
// compileOptions {
// sourceCompatibility JavaVersion.VERSION_1_5
// targetCompatibility JavaVersion.VERSION_1_5
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.3'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
// compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:design:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.code.gson:gson:2.2.1'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/PayPalAndroidSDK-2.9.10.jar')
compile files('libs/gcm.jar')
}
Please, change
classpath 'com.android.tools.build:gradle:1.1.3'
with
classpath 'com.android.tools.build:gradle:1.5.1'
or
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
Please, change (if needed)
distributionUrl=https\://services.gradle.org/distributions/gradle-X.X-all.zip
with
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
Consider also upgrading (if you haven't done yet) upgrade Android Studio to the latest one
It should work.
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)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:+'
classpath 'com.jakewharton.hugo:hugo-plugin:1.1.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'hugo'
configurations {
preprocess
}
android {
compileSdkVersion 21
buildToolsVersion "21.0.2"
defaultConfig {
applicationId "uz.taxiapp.android"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
// make sure that lint errors don't fail the build as lint does not always work properly with the android gradle plugin
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-v4:$depAndroidSupportVersion"
compile "com.android.support:support-v13:20.0.+"
compile "com.android.support:appcompat-v7:$depAndroidSupportVersion"
compile 'com.google.android.gms:play-services:6+'
compile "com.android.support:recyclerview-v7:$depAndroidSupportVersion"
compile "com.j256.ormlite:ormlite-android:$depOrmLiteVersion"
compile "com.google.code.gson:gson:$depGsonVersion"
preprocess "com.squareup.dagger:dagger-compiler:$depDaggerVersion"
compile "com.squareup.dagger:dagger:$depDaggerVersion"
compile "com.squareup.picasso:picasso:$depPicassoVersion"
compile "com.squareup:otto:$depOttoVersion"
compile "com.squareup.retrofit:retrofit:$depRetrofitVersion"
preprocess "com.jakewharton:butterknife:$depButterKnifeVersion"
compile "com.jakewharton:butterknife:$depButterKnifeVersion"
compile "com.jakewharton.timber:timber:$depTimberVersion"
compile project (':JobQueue')
compile "com.jpardogo.googleprogressbar:library:$depGoogleProgressbarVersion"
compile 'com.iangclifton.android:floatlabel:1.0.1'}
android.applicationVariants.all { variant ->
//Where to place the generated code
variant.ext.set("gen_${variant.dirName}", file("${project.buildDir}/source/gen/${variant.dirName}"))
//Do the actual preprocessor things
variant.javaCompile.doFirst {
File out = variant.ext.get("gen_${variant.dirName}")
out.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.preprocess.getAsPath(),
'-s', out
]
}
}
This gradle code returns error
Error:Execution failed for task ':app:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Алексей\AppData\Local\Android\sdk\build-tools\21.0.2\aapt.exe'' finished with non-zero exit value 1
If you have installed Java 8, uninstall it completely install Java 7 by updating the environment variables.