在将Android Studio更新到v 3.2之后,第一次尝试生成Signed Bundle时出现错误:
Android resource linking failed
Output: error: invalid config 'auto' for -c option.
Command: /home/yuliia/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.0-4818971-linux.jar/3c2f2255ccccab2125c4cc0eaccd5fdd/aapt2-3.2.0-4818971-linux/aapt2 link --proto-format\
-I\
/home/yuliia/Android/Sdk/platforms/android-27/android.jar\
--manifest\
/home/yuliia/Documents/projects/android_projects/OCRme/app/build/intermediates/merged_manifests/release/processReleaseManifest/merged/AndroidManifest.xml\
-o\
/home/yuliia/Documents/projects/android_projects/OCRme/app/build/intermediates/linked_res_for_bundle/release/bundleReleaseResources/bundled-res.ap_\
-R\
/home/yuliia/Documents/projects/android_projects/OCRme/app/build/intermediates/res/merged/release/color_abc_tint_seek_thumb.xml.flat\
-R\
/home/yuliia/Documents/projects/android_projects/OCRme/app/build/intermediates/res/merged/release/drawable-xhdpi-v4_abc_popup_background_mtrl_mult.9.png.flat\
-R\
/home/yuliia/Documents/projects/android_projects/OCRme/app/build/intermediates/res/merged/release/drawable-xxhdpi-v4_abc_btn_check_to_on_mtrl_015.png.flat\
-R\
....
/home/yuliia/Documents/projects/android_projects/OCRme/app/build/intermediates/res/merged/release/layout_activity_get_more_requests.xml.flat\
--auto-add-overlay\
-0\
apk\
-c\
auto\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.0-4818971-linux Daemon #0
我如何使其起作用?
答案 0 :(得分:4)
您必须对resConfig使用'auto'选项。标准版本不推荐使用“自动”功能,捆绑包中不支持“自动”功能(错误弹出后,警告可能会丢失在日志中):
android {
defaultConfig {
...
resConfigs "auto"
}
}
该捆绑包中仍支持非'auto'resConfigs,因此只需指定您要保留的语言即可,如documentation中所述:
android {
defaultConfig {
...
resConfigs "en", "fr"
}
}