安装 facebook-connect 插件后 Ionic 构建失败
Posted
技术标签:
【中文标题】安装 facebook-connect 插件后 Ionic 构建失败【英文标题】:Ionic build failed after installing facebook-connect plugin 【发布时间】:2021-11-02 10:29:33 【问题描述】:我有一个 ionic 1 应用程序,它为 ios 成功构建但在 android 上失败。
如果我删除了cordova-plugin-facebook-connect
,它也会为 android 成功构建,所以我认为是插件导致了失败。
此外,这个问题只是在我将 android-minSdkVersion
从 19 升级到 28 后才开始出现的 - 这是 Google Play 要求的。
我已经安装了cordova-plugin-androidx
和cordova-plugin-androidx-adapter
。
这是我在运行ionic cordova run android
时收到的消息。
Task :app:processDebugManifest FAILED
C:\Users\me\projects\myapp\platforms\android\app\src\main\AndroidManifest.xml:20:9-55 Error:
Missing 'package' key attribute on element package at AndroidManifest.xml:20:9-55
C:\Users\me\projects\myapp\platforms\android\app\src\main\AndroidManifest.xml Error:
Validation failed, exiting
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
22 actionable tasks: 4 executed, 18 up-to-date
C:\Users\me\projects\myapp\platforms\android\gradlew: Command failed with exit code 1 Error output:
C:\Users\me\projects\myapp\platforms\android\app\src\main\AndroidManifest.xml:20:9-55 Error:
Missing 'package' key attribute on element package at AndroidManifest.xml:20:9-55
C:\Users\me\projects\myapp\platforms\android\app\src\main\AndroidManifest.xml Error:
Validation failed, exiting
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugManifest'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 9s
[ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --device exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
这是我的ionic info
:
Ionic:
Ionic CLI : 5.2.3 (C:\Users\me\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic1 1.3.4
@ionic/v1-toolkit : 3.2.15
Cordova:
Cordova CLI : not installed
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 10 other plugins)
Utility:
cordova-res : 0.15.2
native-run : 0.2.8
System:
NodeJS : v10.16.0 (C:\Program Files\nodejs\node.exe)
npm : 6.9.0
OS : Windows 10
这是我的插件列表:
> cordova.cmd plugin ls
cordova-plugin-add-swift-support 2.0.2 "AddSwiftSupport"
cordova-plugin-androidx 3.0.0 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.3 "cordova-plugin-androidx-adapter"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-facebook-connect 3.1.0 "Facebook Connect"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.1 "cordova-plugin-ionic-webview"
cordova-plugin-sign-in-with-apple 0.1.2 "cordova-plugin-sign-in-with-apple"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.5 "Whitelist"
cordova-signin-with-apple-plugin 0.1.1 "Signin With Apple"
【问题讨论】:
【参考方案1】:您遇到了https://android-developers.googleblog.com/2020/07/preparing-your-build-for-package-visibility-in-android-11.html 中描述的问题。在 https://github.com/cordova-plugin-facebook-connect/cordova-plugin-facebook-connect/issues/81 中,cordova-plugin-facebook-connect
已更新为支持 Android 11 包可见性。这需要更新版本的 Gradle。如果您更新到 cordova-android
9 或更高版本,应该可以解决此问题。
【讨论】:
看准了!非常感谢诺亚。以上是关于安装 facebook-connect 插件后 Ionic 构建失败的主要内容,如果未能解决你的问题,请参考以下文章
Vs Code使用国际化多语言插件-i18n Ally&Vue i18n-插件使用
开发环境Mac 中 IntelliJ IDEA 运行 Python 程序 ( 安装 Python Community Edition 插件 )