0

I just upgrading my android studio to

Android Studio Flamingo | 2022.2.1 Patch 2
Build #AI-222.4459.24.2221.10121639, built on May 12, 2023
Runtime version: 17.0.6+0-17.0.6b802.4-9586694 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.5.1
GC: G1 Young Generation, G1 Old Generation
Memory: 3072M
Cores: 8
Metal Rendering is ON
Registry:
    external.system.auto.import.disabled=true
    ide.text.editor.with.preview.show.floating.toolbar=false
    gradle.version.catalogs.dynamic.support=true

but suddenly my react native project was unable to start in android studio

I got error when it's syncing to my project here is it looks like

Unable to start the daemon process

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.2.1/userguide/gradle_daemon.html
Process command line: /Library/Java/JavaVirtualMachines/jdk-19.jdk/Contents/Home/bin/java -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError --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.prefs/java.util.prefs=ALL-UNNAMED -Xmx2048m -Dfile.encoding=UTF-8 -Duser.country=ID -Duser.language=en -Duser.variant -cp /Users/mochammadhendy_l/.gradle/wrapper/dists/gradle-6.2.1-bin/5m14x4d33sfxbtkeo25s43l8q/gradle-6.2.1/lib/gradle-launcher-6.2.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.2.1
Please read the following process output to find out more:
-----------------------
Unrecognized VM option 'MaxPermSize=512m'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

-----------------------
Check the JVM arguments defined for the gradle process in:
 - gradle.properties in project root directory

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.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

android.useAndroidX=true
android.enableJetifier=true

is there any way to make fix without downgrad

HendyCrcs
  • 111
  • 11

1 Answers1

1

There are two major problems in your setup.

  1. you are using a Java version to run Gradle with which your Gradle version is not compatible with. See https://docs.gradle.org/current/userguide/compatibility.html for detailed information.

  2. as the error tells you, you are using -XX:MaxPermSize in org.gradle.jvmargs. This option is not used anymore since Java 8 which also is the minimum supported version to run Gradle, so the option is totally useless. Additionally, in the meantime the option was removed and thus your try to start with that option fails with a hard error. Remove that option and all should be fine for this part, but point 1 stays valid.

Vampire
  • 35,631
  • 4
  • 76
  • 102