gradle rebuilds projects even if no changes - android

I see that gradle often builds project even if I touched no one line of code, when I just restarting application.
How can I see what is the reason, why rebuilding happened?
Here is my gradle.properties
#Gradle configuration
org.gradle.daemon=true
org.gradle.jvmargs=-Xms512m -Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
android.enableBuildCache=true
Some more facts:
Gradle v.2.14.1
androidMinSdkVersion = 16
androidTargetSdkVersion = 24
androidCompileSdkVersion = 24

Related

Unable to start daemon process - Android Studio

I opened a project in Android Studio today, and gradle showed the error below.
Then I tried to create a new project, but it still showed the same error.
It had no problem a few days ago, but it suddenly can not work today.
However, it works fine on another Windows account.
This is the error message :
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/7.2/userguide/gradle_daemon.html
Process command line: C:\Program Files\Android\Android Studio\jre\bin\java.exe --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=TW -Duser.language=zh -Duser.variant -cp C:\Users\鄭傑仁\.gradle\wrapper\dists\gradle-7.2-bin\2dnblmf4td7x66yl1d74lt32g\gradle-7.2\lib\gradle-launcher-7.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.2
Please read the following process output to find out more:
-----------------------
�隤�: �銝��瘜�銝餉�� org.gradle.launcher.daemon.bootstrap.GradleDaemon
����: java.lang.ClassNotFoundException: org.gradle.launcher.daemon.bootstrap.GradleDaemon
-----------------------
Check the JVM arguments defined for the gradle process in:
- gradle.properties in project root directory
This is gradle.properties
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
kotlin.code.style=official
android.nonTransitiveRClass=true
Here are what I had tried :
change org.gradle.jvmargs=-Xmx2048m to other values, such as 1024m or 512m
run Android Studio with administrator
delete MyApplication/gradle and sync again
delete C:/User/UserName/gradle and restart Android Studio
reinstall Android Studio

Getting Out of memory: Java heap space. OR GC overhead limit exceeded when building release APK after Android studio 3.4 update

After upgrade of Android Studio 3.4 getting below error.
Gradel plugin version is: 3.4.0
Out of memory: Java heap space. Please assign more memory to Gradle in
the project's gradle.properties file. For example, the following line,
in the gradle.properties file sets the maximum Java heap size to
1,024 MB: org.gradle.jvmargs=-Xmx1024m Read Gradle's
configuration guide Read about Java's heap size
OR
GC overhead limit exceeded
I have applied below solution but it doesn't work.
Option: 1
dexOptions {
javaMaxHeapSize "4g"
}
Option: 2
org.gradle.configureondemand=false
Option: 3
Open gradle.properties file from your project tree add this line at the memory allocation line
org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m
or
org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m
or
org.gradle.jvmargs=-XX\:MaxHeapSize\=1024m -Xmx1024m
Please help me to solve this issue. Thanks in Advance!
1024M is not much for Gradle, for example:
# #see https://docs.gradle.org/current/userguide/build_environment.html
org.gradle.jvmargs=-Xmx5084M -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.configureondemand=true
org.gradle.parallel=true
try values alike -Xmx2048M or -Xmx4096M ...
I don't know it is a valid answer or not.
I have downgraded my gradle plugin version 3.4.0 to 3.3.2
It's work perfectly.
Try this, It is working for me.
Replace below code to your gradle.properties file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
Step 1 : Start Android studio and close any open project (File > Close Project).
Step 2 : On Welcome window, Go to Configure > Settings.
Step 3 : Go to Build, Execution, Deployment > Compiler
Step 4 : Change Build process heap size (Mbytes) to 512 and Additional build process to VM Options to -Xmx512m. Or any memory allocation in correspondent to your PC
Step 5 : Revalidate/Restart Android Studio.

Android Studio: Task '-' not found in root project '[Project Name]' after speeding up build

I have been trying to speed up the gradle build time in Android Studio, and now whenever I Build or Sync my project I get the error:
Error:FAILURE: Build failed with an exception.
* What went wrong:
Task '-' not found in root project '[Project Name]'.
* Try:
Run gradle tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
After days of googling, I have not found anything. Does anyone know what may have caused this error, I cannot test my project now.
Every other question does not specify the task '-', but something else.
I have supplemented in "[Project Name]" for the actual project name.
My project build.gradle is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// 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
}
And my module build.gradle is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23"
defaultConfig {
applicationId "ca.lakeeffect.scoutingapp"
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.0.0'
}
And my gradle.properties:
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.j# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Settings specified in this file will override any Gradle settings
# configured through the IDE.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
# TODO: disable daemon on CI, since builds should be clean and reliable on servers
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=truevmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
I didn't know what to do, so as a last resort, I made a new project and copied over my code. I then hit File > Restart and rebuilt my project a couple of times. That worked! If anyone else finds the real answer that would be awesome to know.

Error creating new Android project: Unable to start the daemon process

When I try to create a new project in Android Studio, I get the following error.
Update:
This is how my gradle-wrapper.properties (located at <project_folder>\gradle\wrapper) looks like:
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
org.gradle.jvmargs=-XX\:MaxHeapSize\=1024m -Xmx1024m
You need to increse the heap size and Change Build process heap size (Mbytes) to 1024 and Additional build process to VM Options to -Xmx512m.
Refer this solution
Try tweaking memory options in gradle.properties file in your project.
Open the gradle.properties file and check these lines
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default notes: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

How can i solve error: java.lang.OutOfMemoryError: GC overhead limit exceeded?

I update my Android Studio and try to run an app but it shows the error like this..
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.OutOfMemoryError: GC overhead limit exceeded
before updation of Android Studio same app run fine, so i tried to solve the issue i found only one which is i already done into gradle file..
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
So now what can i do to solve this issue, please help me out. Thanks.
Add this to your gradle.properties file.
# The Gradle daemon aims to improve the startup and execution time of Gradle.
# When set to true the Gradle daemon is to run the build.
org.gradle.daemon=true
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
org.gradle.parallel=true
# Enables new incubating mode that makes Gradle selective when configuring projects.
# Only relevant projects are configured which results in faster builds for large multi-projects.
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:configuration_on_demand
org.gradle.configureondemand=true
And on my build.gradle :
....
dexOptions
{
incremental false
javaMaxHeapSize "2048M"
preDexLibraries = false
}//end dexOptions
....
Found Here
And My answer Here
go to "System Properties" -> "Advanced"
Environment Variables
Edit _JAVA_OPTIONS values from "-Xms1024m" to "-Xms2048m"
(if not Exist _JAVA_OPTIONS then create it by clicking on New Button)
Ok, save and restart system
I think it will be helpfull for you

Categories

Resources