Actually the main error is "java.exe
finished with non-zero exit value 1". First i tell you every problem which i faced after installing studio:
Three days ago, i just installed android studio & I created new project.
1) First it throw the error "Plugin is too old, please update to more recent version", after searching on google i changed
classpath : com.android.tools.build:gradle:2.0.0-alpha2
to
classpath : com.android.tools.build:gradle:2.0.0-alpha8
Current Error solved.
2) After that it was asking for gradle 2.10
, i updated this one also & set the path.
Current Error solved.
3) When i ran my application i got one more error "app-debug-unaligned.apk
, specified for property 'input file' does not exist".
I searched on internet, i got one solution on stackoverflow. So as answer on stackoverflow i go to "Build" & i selected build apk
.
Current error solved.
4) But after that again i got one error
"To run dex in process, the Gradle daemon needs a larger heap. It currently has 910 MB. For faster builds, increase the maximum heap size for the Gradle daemon to more than 1G.
java.exe
finished with non-zero exit value 1".
I have been searching on stackoverflow for last three days, i applied each and every answer one by one but i'm not able to solve the error. Please save my life, i am really tired of this problem. I show you image what error is coming exactly
My build.gradle
file
apply `plugin: com.android.application`
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "java.danish.org.myapplication"
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'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
}
I updated everything SDK platforms & SDk Tools.
Please tell me what i am doing wrong here.
512MB is more than enough for most builds. Larger builds with hundreds of subprojects, lots of configuration, and source code may require, or perform better, with more memory.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB. To do this set org. gradle. jvmargs=-Xmx2048M in the project gradle.
Go To C:\Users\"Username"\. gradle\daemon. There are a Folder for each version of gradle. Delete the folder of your actual running version Check with --status.
org.gradle.jvmargs - specifies jvmargs used for daemon process. You want to set high enough memory limit to fix dex in Gradle process, so minimum configuration here is -Xmx2g , while 3-4 gigabytes won't hurt either.
In gradle plugin version 2.0.0-alpha7 and -alpha8 Dex runs inside gradle build process as opposed to a separate process.
Change gradle plugin version to 2.0.0-alpha9 where in-process Dex is disabled by default.
classpath 'com.android.tools.build:gradle:2.0.0-alpha9'
Disable in-process dex in your app module build.gradle
:
android {
// ...
dexOptions {
dexInProcess = false
}
}
Increase memory available to gradle process.
Create or update gradle.properties
file in your project root directory:
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=512m
And update your app module build.gradle
file:
dexOptions {
preDexLibraries true
javaMaxHeapSize "3g"
incremental true
dexInProcess = true
}
These values are experimental and work for my setup. I use 3 GB for dex and 4 GB for gradle (3 + 1 GB).
If you have any issues update to alpha9 anyway.
I found the solution.
Changes 1)
dexOptions {
javaMaxHeapSize "4g"
}
2)
lintOptions {
checkReleaseBuilds false
abortOnError false
}
This is my new build.gradle
and everything is working fine now.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc4"
dexOptions {
javaMaxHeapSize "4g"
}
defaultConfig {
applicationId "com.aquasoft.guesp"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
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.4.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:design:23.4.0'
compile 'com.stripe:stripe-android:+'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.android.support:cardview-v7:23.3.+'
}
try this gradle params
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With