bin^2

bin^2

discord server
twitter

Android Tips 2023-03-29

#Android #Dev #Tip
#构建 #性能 #优化

Android Gradle Plugin 7 开始支持单独配置 BuildFeatures,可以通过关闭不需要的 Features 来提高构建速度

Usage#

build.gradle

android {
	buildFeatures{
		aidl false
		buildConfig false
		compose false
		prefab false
		renderScript false
		resValues false
		shaders false
		viewBinding false
		dataBinding false
	}
}

使用 gradle.properties 统一配置#

gradle.properties

android.defaults.buildfeatures.aidl=false
android.defaults.buildfeatures.compose=true
android.defaults.buildfeatures.renderscript=false
android.defaults.buildfeatures.shaders=false

android.library.defaults.buildfeatures.buildconfig=false
android.library.defaults.buildfeatures.resvalues=false

Ref#

https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/BuildFeatures

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.