Android studio - finished with non-zero exit value 1 exception - android

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.

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

Error trying to use HelloCharts - Unexpected Top Level Exception

I tried to avoid asking this question since it has been asked numerous times on this site. I have tried every which way to successfully run my app with HelloCharts included but have failed too many times. I have moved the dependencies around as well as the repositories hoping it would fix it but no luck.
I am getting a top level exception every time I try to run my app. Below is my build.gradle (app).Thank you in advance for your help.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "REMOVED FOR THIS POST"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
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:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.github.lecho:hellocharts-library:1.5.8#aar'
compile 'com.github.lecho:hellocharts-android:v1.5.8'
}
Here are the instructions from github:
Android Studio/Gradle
Maven Central/jCenter, add dependency to your build.gradle:
dependencies{
compile 'com.github.lecho:hellocharts-library:1.5.8#aar'
}
JitPack.io, add jitpack.io repositiory and dependency to your build.gradle:
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.lecho:hellocharts-android:v1.5.8'
}
Here is the error I keep getting:
UNEXPECTED TOP-LEVEL EXCEPTION:
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.8.0_66\bin\java.exe'' finished with non-zero exit value 2
I figured it out. I was putting both the "Maven Central/jCenter, add dependency to your build.gradle:" and "JitPack.io, add jitpack.io repositiory and dependency to your build.gradle:" pieces of code. I removed the below code from my build.gradle and it worked fine:
dependencies{
compile 'com.github.lecho:hellocharts-library:1.5.8#aar'
}

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"
}

Android - "Execution Failed, java.exe finished with non-zero exit value 2" when trying to integrate Twitter Fabric

I installed Fabric in my project using Android Studio's Fabric plugin. It prevented a lot of other bugs I was getting, but I still get java.exe finishing poorly. I tried out all the other links on java.exe exiting with value 2, and nothing helped or was applicable.
Here's my build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.youtubemaster"
minSdkVersion 11
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:recyclerview-v7:21.0.3'
compile 'com.google.code.gson:gson:2.3.1'
compile ('com.facebook.android:facebook-android-sdk:4.0.0')
{
exclude group: 'com.google.android', module: 'support-v4'
}
compile files('libs/picasso-2.5.2.jar')
compile files('libs/retrofit-1.9.0.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile('com.twitter.sdk.android:twitter:1.4.0#aar') {
transitive = true;
}
}
Since you are using Twitter sdk, which already contains Retrofit and gson,
you will have to remove the following from your gradle
compile 'com.google.code.gson:gson:2.3.1'
compile files('libs/retrofit-1.9.0.jar')
I too had the problem.
I ran into the same problem now and fixed it by enabling multidex.
https://developer.android.com/tools/building/multidex.html#mdex-gradle
Add this into your build.gradle:
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
dependencies {
/* Enabling multidex*/
compile 'com.android.support:multidex:1.0.0'
}
Add this into your manifest:
<!--Supporting multidex-->
<application
android:name="android.support.multidex.MultiDexApplication" >
You will need multidex when you have exceeded your method count of 65536 which is actually quite easy to do if you add different libraries onto your build.gradle.

Categories

Resources