android - 长时间的 Android 构建时间挂在 minify 上
问题描述
最近我一直在扩展我的项目以包含com.google.firebase:firebase-auth:19.3.0
功能。结果我遇到了以下错误:Cannot fit requested classes in a single dex file (# methods: 112748 > 65536)。解决方案是在multiDexEnabled
我使用minSdkVersion 16
.
我现在面临的问题是构建时间似乎没有尽头(我在 5 分钟后取消了它)。minifyEnabled
开启时会发生这种情况。我在项目中使用的依赖项如下所示。任何想法为什么minify
需要这么多时间?
implementation 'com.android.billingclient:billing:2.2.0'
implementation 'com.google.android.ads.consent:consent-library:1.0.8'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-games:19.0.0'
implementation 'com.google.android.gms:play-services-instantapps:17.0.0'
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-firestore:21.4.1'
implementation 'androidx.versionedparcelable:versionedparcelable:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.multidex:multidex:2.0.1'
解决方案
在 gradle.properties 中添加以下行,然后查看结果
org.gradle.daemon=true
org.gradle.caching=true
org.gradle.parallel=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx3096M -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
推荐阅读
- .net - 如何确保我的程序始终可以运行,并且如果计算机重新启动或进程死亡,它可以自动重新启动?
- angular - 如何在 Facebook 网页游戏中设置 Facebook 自动登录?
- google-apps-script - Google 表格中有关 Google Chart API 的问题
- arrays - 如何从 Flutter 中的另一个类访问/调用数组(列表)数据?
- c++ - 使用 C 链接在函数内部创建 C++ 模板
- python - 如何检测图片中物体的宽度
- docker - Docker 容器的端口与不在容器内的 nginx 发生冲突
- python - 在 Docker 映像中指定 AWS 凭证
- javascript - 使用动态生成的表的邻居计数
- python - 如何在 HTML 代码中使用 re.findall/search 执行复杂的“if 语句”?