防止gradle安装模拟器

zhte4eai  于 2023-11-18  发布在  其他
关注(0)|答案(1)|浏览(182)

我写了一个bash脚本,我的Android项目将在其中构建。我可以成功安装gradlesdk工具。我用gradle wrapper创建 Package 器。但是当我想使用./gradlew assembleDebug -x lint获得调试apk时,需要很长时间才能下载模拟器:

Checking the license for package SDK Patch Applier v4 in /build/sdk/licenses
License for package SDK Patch Applier v4 accepted.
Preparing "Install SDK Patch Applier v4 (revision: 1)".
"Install SDK Patch Applier v4 (revision: 1)" ready.
Installing SDK Patch Applier v4 in /build/sdk/patcher/v4
"Install SDK Patch Applier v4 (revision: 1)" complete.
"Install SDK Patch Applier v4 (revision: 1)" finished.
Checking the license for package Android Emulator in /build/sdk/licenses
License for package Android Emulator accepted.
Preparing "Install Android Emulator (revision: 32.1.12)".

字符串
我还使用-d运行了该命令,并找到了模拟器版本。接下来,我下载了模拟器zip并将其解压缩到正确的目录。但是当我再次运行assembleDebug时,我得到了以下警告:

Package "com.android.repository.impl.generated.v2.RemotePackage@86464c36" (emulator) should be installed in  "/usr/lib/sdk/emulator" but it already exists. Installing in "/usr/lib/sdk/emulator-2" instead.


我想跳过下载模拟器(如果它可用)或将zip文件传递给它,以防止停留在此状态。

j13ufse2

j13ufse21#

通过在gradle.properties中设置标志,可以禁用Gradle Package 器自动SDK下载:
要手动禁用此功能,请在项目的gradle.properties文件中设置android.builder.sdkDownload=false。
https://developer.android.com/studio/intro/update#download-with-gradle

相关问题