jdk1.8.0 finished with non-zero exit value 2 - android

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)

Related

Android studio - build failed '/home/node/Android/Sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1

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

Execution failed for task ':app:transformClassesWithDexForDebug' Error while gradle build

I am trying to add an library to the android application. I have added library as dependency in the project settings.
Then when I tried building the project, gradle shows below error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0\bin\java.exe'' finished with non-zero exit value 1
I searched for it and found many solutions, but none of it is working in my case. Please find below my app build.gradle and library build.gradle files
app level build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.application.package"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile project(':library')
}
and library build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "v0.1L"
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:design:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
}
also, find below my project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am stuck in this issue for complete 1 day. Please help me solve this issue.
Thanks,
Rajan
Try to change
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
...
}
to
dependencies {
provided fileTree(dir: 'libs', include: ['*.jar'])
...
}

Android Studio: Execution fails when I add SignalR client library

I have downloaded signalr client library from https://github.com/SignalR/java-client. On build it generated jar files.
When I add the jar files to my project, the project builds but when I try to run I get the error message below:
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_25\bin\java.exe'' finished with non-zero exit value 1
Previously I followed the tutorial on https://whathecode.wordpress.com/2014/03/20/getting-started-with-the-java-signalr-sdk/ and downloaded jar files from https://www.mediafire.com/?8qun6hbs3onnbbl. Those jar files were working fine.
However I needed the WebSocket transport protocol which were implemented in the latest version.
I am not sure if removal of previous jar files causing any issues.
Gradle scripts:
signalr-client-sdk
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.gson:gson:2.2.2'
compile 'org.java-websocket:java-websocket:1.3.1'
}
-signalr-client-sdk-android
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
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:21.0.3'
compile project(':signalr-client-sdk')
}
-My project
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "com.eb5.uvexa.uvexadriver"
minSdkVersion 17
targetSdkVersion 21
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
debug {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions
{
preDexLibraries=false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile files('libs/gson-2.2.2.jar')
compile files('libs/mail.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/signalr-client-sdk.jar')
compile files('libs/signalr-client-sdk-android.jar')
}
I tried clean and rebuild, restarted the pc and also Invalidate option in Android Studio.
I am using windows10 and Android Studio(64). What am I doing wrong?

Android Studio: java.exe finished with non-zero exit value 2

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'

com.android.build.transform.api.TransformException with android google play services

I'm trying to integrate Google Plus in my application, and it showing following error. below are exception and gradle
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.transform.api.TransformException: 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 1
app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "xxx.com.xxxx"
multiDexEnabled true
minSdkVersion 15
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.android.support:appcompat-v7:23.0.1'
//depend-materialcalendar
compile 'com.prolificinteractive:material-calendarview:0.8.1'
compile 'com.android.support:gridlayout-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
//depend-cometchat
compile 'com.yalantis:contextmenu:1.0.4'
compile 'com.google.code.gson:gson:2.3'
compile files('libs/appcompat_v7.jar')
compile files('libs/cometchat-sdk.jar')
compile files('libs/jsoup-1.7.3.jar')
compile files('libs/picasso-2.5.2.jar')
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-base:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'
compile files('libs/volley.jar')
compile files('libs/PayPalAndroidSDK.jar')
compile files('libs/gcm.jar')
compile 'com.soundcloud.android:android-crop:1.0.1#aar'
compile 'com.facebook.android:facebook-android-sdk:4.6.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
}
project build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Try cleaning your project and then re-building.
Try adding multiDexEnabled true in your app build.gradle file.
defaultConfig {
multiDexEnabled true
}
I have added this on the Application class:
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
In my app build.grade file:
defaultConfig {
applicationId "com.example.android.exampleapp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
and added this as dependency:
compile 'com.android.support:multidex:1.0.0'
This solved my problem. Thanks
I just had the same problem in my current project when I moved the Android Gradle Plugin Version from 1.3.0 to 1.5.0.
The error was nearly the same one as the error of the OP except that java returned error code 2.
If finally turned out that I had the same jar file included in two different modules of the app.
Version 1.3.0 could handle this without problems, for version 1.5.0 I had to replace the jar files with a dependency for a separate module that contained a single copy of the jar file.
I have tried with adding
multiDexEnabled true
but did not work. then I have changed my build version from 23.0.2 to
buildToolsVersion "23.0.3"
then it works. hope it may help you.
try to add these line in your gradle
dexOptions {
javaMaxHeapSize "4g"
}

Categories

Resources