1.开启 gradle 单独的守护进程
Windows: 进入目录
C:\Users\Administrator\.gradle
创建文件: gradle.properties
# 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=true
2.查看android Studio 分配的运行内存,手动更改内存配置
File -> settings...
更改
Help -> Edit Custom Vm Options... 添加 保存退出 重新打开
-Xms256m
-Xmx2048m
3.配置好 Gradle home
file->setting->gradle
找到 androidStudio 安装路径
如: E:/AndroidStudio/gradle/gradle-8.0.1
4 打开时优化 跳过检查sdk 啥的
进入 androidStudio 安卓目录 在bin 目录 找到 idea.properties 文件 在末尾添加:
disable.android.first.run=true