目前打包速度很慢:本地打包Release在14分钟以上,Jekins打包都在20分钟左右。
项目是模块化结构,代码是Java和Kotlin混编。前不久有过一次Gradle升级,分别是AGP从4.0.1 → 7.4.2,Gradle从6.8.0 → 7.5.1
我也不清楚是不是此次升级导致的兼容问题,本地编译速度是快了点,但是打包速度一下子掉了下来,以前只要10分钟不到。
通过Studio的Build发现,minifyReleaseWithR8占用了近70%~80%的构建时间,不停地打印如下信息
“AGPBI: {"kind":"warning","text":"Expected stack map table for method with non-linear control flow. In later version of R8, the method may be assumed not reachable.","sources":[{"file":"D:\Projects\branch\code\XX\build\intermediates\transforms\TeaTransform\english\release\37.jar"}],"tool":"R8"}”
Java 11、Gradle 7.5.1、AGP 7.4.2、Kotlin 1.6.21
# 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.
# 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=-Xmx5g -XX:MaxPermSize=4g -XX:+HeapDumpOnOutOfMemoryError -XX:+UseG1GC
# 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
org.gradle.caching=true
#android.enableBuildCache=true
# å¼å¯kotlinçå¢éåå¹¶è¡ç¼è¯
kotlin.compiler.incremental=true
kotlin.incremental=true
kotlin.incremental.java=true
kotlin.incremental.js=true
kotlin.caching.enabled=true
kotlin.parallel.tasks.in.project=true
#android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
# ä¼åkapt
kapt.use.worker.api=true
kapt.incremental.apt=true
kapt.include.compile.classpath=false
android.injected.testOnly=false
isNeedCourseModule=true
#isNeedCourseModule=false
所以求助分析下,该如何解决打包慢的问题。