英文:
How to prevent android studio gradle from auto downloading emulator
问题
When creating new projects with Android Studio Flamingo 2022.2.1 and Gradle 8.0, it automatically starts downloading the emulator.
I have an Android device connected. I do not need a new emulator. How to bypass this annoying "Preparing"?
It also installs another build-tools 33.0.2, totally ignoring my existing tools of version 30.0.3.
And the project is a pure Java project, the Gradle build scripts are in Groovy, there is no relationship between my project and Kotlin. Why is there a task named "prepareKotlinBuildScriptModel"? I can remember such a task didn't exist a year ago.
英文:
When creating new projects with android studio Flamingo 2022.2.1, gradle 8.0, it automatically starts downloading emulator
...
:prepareKotlinBuildScriptModel
...
Preparing "Install Android Emulator (revision: xx.x.x)"
I have an android device connected. I do not need a new emulator. How to bypass this annoying "Preparing"?
It also installs another build-tools 33.0.2, totally ignoring my existing tools of version 30.0.3.
And the project is a pure java project, the gradle build scripts are in Groovy, there is no relationship between my project and kotlin, why is there a task named "prepareKotlinBuildScriptModel"? I can remember such task didn't exist a year ago.
答案1
得分: 1
为了阻止Android Studio自动下载模拟器,您可以在Android SDK Manager中禁用"Android Emulator"选项。
以下是步骤:
- 打开Android Studio,点击工具栏中的"SDK Manager"(或者转到"文件" -> "设置" -> "外观与行为" -> "系统设置" -> "Android SDK")。
- 在"SDK平台"选项卡中,取消选中"Android Emulator"选项。
- 点击"应用"以保存更改。
这将防止Android Studio自动下载模拟器。
至于安装build-tools 33.0.2,可能是因为您正在使用的Android Gradle插件需要该版本的构建工具。您可以通过查看build.gradle文件来检查您的项目中正在使用的Android Gradle插件的版本。如果您想使用不同版本的构建工具,可以在build.gradle文件中使用buildToolsVersion属性来指定它。
至于"prepareKotlinBuildScriptModel"任务,这是在Gradle 6.0中引入的新任务。该任务负责生成Kotlin构建脚本模型,用于配置Gradle的Kotlin插件。即使您的项目是纯Java项目并且不使用Kotlin插件,Gradle仍然会执行此任务。但是,如果您不使用Kotlin插件,可以安全地忽略此任务。
英文:
To prevent Android Studio from automatically downloading the emulator, you can disable the "Android Emulator" option in the Android SDK Manager.
Here are the steps:
- Open Android Studio and click on "SDK Manager" in the toolbar (or go to "File" -> "Settings" -> "Appearance & Behavior" -> "System Settings" -> "Android SDK").
- In the "SDK Platforms" tab, uncheck the "Android Emulator" option.
- Click "Apply" to save the changes.
This should prevent Android Studio from automatically downloading the emulator.
Regarding the installation of build-tools 33.0.2, this may be happening because the Android Gradle plugin you are using requires that version of the build tools. You can check which version of the Android Gradle plugin you are using in your project by looking at the build.gradle file. If you want to use a different version of the build tools, you can specify it in your build.gradle file using the buildToolsVersion property.
As for the "prepareKotlinBuildScriptModel" task, it is a new task introduced in Gradle 6.0. The task is responsible for generating the Kotlin build script model, which is used to configure the Kotlin plugin for Gradle. Even if your project is a pure Java project and you are not using the Kotlin plugin, this task will still be executed by Gradle. However, you can safely ignore this task if you are not using the Kotlin plugin.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论