Android Studio - Gradle commands spanning multiple Java process - android

When I run gradlew commands or when Android Studio starts, It spanning one java process in every second, Which ends up using 100% of system memory usage. It was fine in the last android studio version, any idea how to fix this?
About the system
Android Studio 4.1.2
java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)
Gradle 6.5
CPU AMD Ryzen 7 2700
Memory 32GB
I tried updating gradle.properties
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs = -Xms512m -Xmx512m -XX:+UseCompressedOops -XX:+HeapDumpOnOutOfMemoryError

The issue is Windows 10 Mobile hotspot, When the Mobile hotspot is turned on Windows refuses to connect 127.0.0.1, Which is necessary for the Gradle daemon.
The fix is just to turn off the Windows Mobile Hotspot

Related

getting error create new project in android studio

hello guys i updated my android studio 4.0 to 4.1
getting error after updating android studio build.gradle. i tried completely uninstall android studio but didn't worked again
log
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/6.5/userguide/gradle_daemon.html
Process command line: C:\Program Files\Android\Android Studio\jre\bin\java.exe -XX:MaxPermSize=512m -Xmx2048m -Dfile.encoding=windows-1252 -Duser.country=GB -Duser.language=en -Duser.variant -cp C:\Users\Onur\.gradle\wrapper\dists\gradle-6.5-bin\6nifqtx7604sqp1q6g8wikw7p\gradle-6.5\lib\gradle-launcher-6.5.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.5
Please read the following process output to find out more:
-----------------------
Error occurred during initialization of VM
Could not reserve enough space for object heap
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
-----------------------
Check the JVM arguments defined for the gradle process in:
- gradle.properties in project root directory
And memory usage %100. i tried exit android studio but java jdk exe uses computer ram %100 again
what's problem? someone help please? i want to use this project my website başvuru tarihi
Your computer probably does not have the right specifications to run android studio. You need more RAM and processing speed

Gradle daemon unable to start jvm no Xmx1024 or any other error

I Have Tried A Many ways To Do Successful Gradle Build
Tried A Lott Of Ways online But I can't Even I Have Changed org.gradle.jvmargs=-Xmx5124m
Toorg.gradle.jvmargs=-Xmx1024m
To
org.gradle.jvmargs=-Xmx512m
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 guide chapter on the daemon at https://docs.gradle.org/4.4/userguide/gradle_daemon.html
Please read the following process output to find out more:
-----------------------
.
PC Info:
OS:Windows 8
Android Studio 3.1.4
Build #AI-173.4907809, built on July 23, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 8.1 6.3
You can go to .gradle folder in your $USER_HOME and delete all the directories except wrapper. then build again in android studio and it will generate deamon again

configuration jdk in android studio with ubuntu 17.10 not found java home

When I open Android studio, I am getting the following error:
java_home not found
My configuration :
Android Studio 3.0
Ubuntu 17.10 Gnome
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
I ran: sudo apt-get install oracle-java8-set-default
(and installed to /usr/lib/jvm/jdk1.8.0/)
I edited "/etc/environment" and set JAVA_HOME="/usr/lib/jvm/jdk1.8.0/"
And added the following lines to "/home/faiberts/.bashrc" and "/root/.bashrc":
export JAVA_HOME="/usr/lib/jvm/jdk1.8.0/"
export PATH=$JAVA_HOME/bin:$PATH"
Do I have some error in some step or it is necessary to change some configuration because I am confused since this is my first time trying to do development in android.
Thank you in advance for your valuable help.

Unable to build android due to incorrect java

I have ubuntu 14.04 and I am trying to build android for BBB. I got BBB android and visited this site to get the correct java.
I took android source from this site
http://bbbandroid.sourceforge.net/build.html
then followed steps for java from this site,
https://source.android.com/source/initializing#for-ubuntu-14-04
I did as the site said.
then make -j4 gave this build error,
============================================
Checking build tools versions...
************************************************************
You are attempting to build with an unsupported JDK.
You use OpenJDK but only Sun/Oracle JDK is supported.
Please follow the machine setup instructions at
https://source.android.com/source/download.html
************************************************************
build/core/main.mk:152: *** stop. Stop.
Then I did this
**java -version**
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
**sudo update-alternatives --config java**
There are 3 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
* 3 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1081 manual mode
Press enter to keep the current choice[*], or type selection number: 3
**sudo update-alternatives --config javac**
There are 2 choices for the alternative javac (providing /usr/bin/javac).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/bin/javac 1061 manual mode
* 2 /usr/lib/jvm/java-8-openjdk-amd64/bin/javac 1081 manual mode
Press enter to keep the current choice[*], or type selection number: 2
again I checked the java -version
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
Its still same as previously.
What is the problem here?
What exactly is supported by google's android, oracle jdk, sun jdk or open jdk?
You need to get the Sun/Oracle JDK, and you are currently using the OpenJDK.
Sun/Oracle JDK is the JDK supported. (Sun is owned by Oracle)
The makefile output answered your question. It must be checking and enforcing the use of Sun/Oracle JDK.
You use OpenJDK but only Sun/Oracle JDK is supported.
Please follow the machine setup instructions at
https://source.android.com/source/download.html
You need to install the Sun/Oracle JDK and then run
sudo update-alternatives --config java
Pick the newly installed version.
I thought I solve this error by reboot computer, make again and the error is gone by unknown reason. But now I just found myself very ridiculous when I try to start the emulator.
Need to re-source to make emulator run with correct environment, see here
xb#dnxb:~/Downloads/android_src/hole$ . build/envsetup.sh
xb#dnxb:~/Downloads/android_src/hole$ lunch aosp_bullhead-userdebug
Now run the emulator:
xb#dnxb:~/Downloads/android_src/hole$ emulator -sysdir out/target/product/generic/ -system out/target/product/generic/system.img -ramdisk out/target/product/generic/ramdisk.img -data out/target/product/generic/userdata.img -kernel prebuilts/qemu-kernel/arm/kernel-qemu-armv7 -memory 2048
emulator: ERROR: Can't access ANDROID_PRODUCT_OUT as '/home/xiaobai/Downloads/android_src/hole/out/target/product/bullhead'
You need to build the Android system before launching the emulator
xb#dnxb:~/Downloads/android_src/hole$
I just realized I only has /home/xiaobai/Downloads/android_src/hole/out/target/product/generic/, no such bullhead (Nexus 5X).
Now I know the reason why I success last time after reboot, this is because of it build with default generic lunch menu aosp_arm-eng, since I didn't redo the steps . build/envsetup.sh and lunch aosp_bullhead-userdebug before rerun make.
And I can see my /etc/environment has this JAVA_HOME set, so sudo update-alternatives --config java never work since /usr/lib/jvm/jdk1.8.0_131/ is Oracle/Sun, not Open JDK (my case is difference with OP, whether requires one of Oracle/Sun or OpenJDK depends on lunch menu):
$ cat /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$PATH"
JAVA_HOME="/usr/lib/jvm/jdk1.8.0_131/"
Modify the /etc/environment to openjdk path (In Ubuntu, it can be download with sudo apt-get install openjdk-8-jdk, then use dpkg -L openjdk-8-jdk to locate the path ), open a new tab shell session, redo the . build/envsetup.sh, lunch aosp_bullhead-userdebug, and make, now it works without jdk error.

draw9patch just hangs on Mac 10.7.5

draw9patch just hangs on my Mac 10.7.5. I have reinstalled the android-sdk-macosx.
In the directory android-sdk-macosx/tools I entered ./draw9patch and it is starting up, but then hanging with a white screen?
I have tried to go to the tools/lib directory and run
java -jar draw9patch.jar
with the same result.
Java:
java version "1.6.0_51"
Java(TM) SE Runtime Environment (build 1.6.0_51-b11-456-11M4508)
Java HotSpot(TM) 64-Bit Server VM (build 20.51-b01-456, mixed mode)
Dump:
https://gist.github.com/powder366/5973285
https://gist.github.com/powder366/5973275
https://gist.github.com/powder366/5973228
Have anyone seen this? Suggestion on how to find the problem?
Update with this Java patch http://support.apple.com/kb/DL1572 also see here https://code.google.com/p/android/issues/detail?id=57473&can=1&q=draw9patch&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
From the script I can see this comment:
# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
# might need more memory, e.g. -Xmx128M
but anyway both command work for me:
java -Djava.ext.dirs=. -jar draw9patch.jar
java -jar draw9patch.jar
Probably you have a failing jar. Can you try with mine?
[I'm on a Mac running Mountain Lion 10.8.4 but I had no problem with Lion 10.7.5]

Categories

Resources