集成jpush_flutter,安卓端编译失败的问题记录

2024-03-10  本文已影响0人  4VZhang

根据文档要求配置

jpush文档.png

控制台打印如下问题:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Running Gradle task 'assembleDebug'...
/Users/xxx/Documents/Projects/Projects_flutter/education_app/android/app/src/main/AndroidManifest.xml:41:9-42 Error:
    Attribute application@name at AndroidManifest.xml:41:9-42 requires a placeholder substitution but no value for <applicationName> is provided.
/Users/fuweizhang/Documents/Projects/Projects_flutter/education_app/android/app/src/debug/AndroidManifest.xml Error:
    Validation failed, exiting

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
> Manifest merger failed with multiple errors, see logs

原因分析:
app/build.gradle中的手动配置的 manifestPlaceholders字典, 覆盖了原有manifestPlaceholders字典中的“ applicationName”字段,导致AndroidManifest.xml中使用applicationName时,获取不到!!!

AndroidManifest.png

解决方案:

 manifestPlaceholders = [
                JPUSH_PKGNAME : applicationId,
                JPUSH_APPKEY : "fa3229b08xxxxb2dea3d39e4", // NOTE: JPush 上注册的包名对应的 Appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
        ]

修改为

 manifestPlaceholders += [
                JPUSH_PKGNAME : applicationId,
                JPUSH_APPKEY : "fa3229b08xxxxb2dea3d39e4", // NOTE: JPush 上注册的包名对应的 Appkey.
                JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
        ]

 manifestPlaceholders["JPUSH_PKGNAME"]="applicationId"
 manifestPlaceholders["JPUSH_APPKEY"]="fa3229b08xxxxb2dea3d39e4"
 manifestPlaceholders["JPUSH_CHANNEL"]="developer-default""

上一篇下一篇

猜你喜欢

热点阅读