1,出現:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app問題,或者出現Error: Some file crunching failed, see logs for details這個問題。
出現這種問題我感覺有文件或圖片的後綴名的原因。
我們項目是從Eclipse上轉到AndroidStudio,會有.9.png的坑,每次出現這樣的問題,我都是這樣改的,直接添加紅色那段就可以,用來關閉AndroidStudio對PNG合法性檢查的:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
aaptOptions {
cruncherEnabled = false
useNewCruncher = false
}
defaultConfig {
applicationId "com.XXXXX.XXXXXXX"
minSdkVersion 17
targetSdkVersion 26
versionCode 561
versionName "5.6.1"
multiDexEnabled true
}
..............
..............
..............
}
2,報錯:Invoke-customs are only supported starting with Android O (--min-api 26)
在build.gradle添加:
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
//...
}
buildTypes {
//...
}
//添加以下代碼
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}