android - 无法生成签名包 - Android 资源链接失败,错误 : invalid config 'auto' for -c option

标签 android android-studio

将 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

我怎样才能让它发挥作用?

最佳答案

您必须为 resConfig 使用“自动”选项。 “auto”已从标准构建中弃用,并且在 bundle 中不受支持(错误弹出后警告可能在日志中丢失):

android {
    defaultConfig {
        ...
        resConfigs "auto"
    }
}

bundle 中仍然支持非“自动”resConfig,因此只需指定您想要保留的语言,如 documentation 中所述。 :

android {
    defaultConfig {
        ...
        resConfigs "en", "fr"
    }
}

关于android - 无法生成签名包 - Android 资源链接失败,错误 : invalid config 'auto' for -c option,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52561487/

相关文章:

java - android java中 '^'(插入符号)的 key 代码?

android - ffmpeg android构建中的libx264编码器错误

android - 无法使用 jcenter 解决 Android Studio 中的依赖关系

android - 应用程序图标不显示 (Android Studio)

android - 为什么我在 Android Studio 的“选择库依赖项”中找不到 com.android.support :design:22. 2.0?

android - Android升级minSdkVersion有什么影响?

android - 使用 RowsFragment 时,ObjectAdapter.setPresenterSelector 有什么作用吗?

android - 如何使用 Jenkins 前端从 git 调试 android 项目?

android - 在 Android 中加载 MapView 瓦片

android:targetPackage 无法解析符号