谷歌 6 月 17 日 Firebase SDK 更新后,Ionic Cordova 应用程序停止编译 [英] Ionic Cordova app stopped compiling after Google's June 17th Firebase SDK update

查看:20
本文介绍了谷歌 6 月 17 日 Firebase SDK 更新后,Ionic Cordova 应用程序停止编译的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Firebase 主要版本更新后,我无法编译 Ionic Cordova 应用程序并进行重大更改,特别是 2019 年 6 月 17 日的更新.

I'm unable to compile Ionic Cordova App after Firebase Major version update with Breaking Changes, specifically with June 17, 2019 update.

我尝试降级到 Android Cordova 6.3.0,但我的项目必须是 7.0.0.

I tried downgrading to Android Cordova 6.3.0 but my project must be 7.0.0.

这是我的离子信息:

@ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.2.1
    Cordova Platforms  : android 7.0.0 browser 5.0.4
    Ionic Framework    : ionic-angular 3.9.3

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.1
    npm               : 5.5.1
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : C:Developmentandroid-sdk

Misc:

    backend : pro

这是我遇到的错误:

:app:processDebugResourcesC:Usersmmzep.gradlecaches ransforms-1files-1.1core-1.0.0.aar73b4a83ab5e76f20c84a66b1c8444d08 esvaluesvalues.xml:133:5-70: AAPT: 错误: 资源 android:找不到 attr/fontVariationSettings.

:app:processDebugResources C:Usersmmzep.gradlecaches ransforms-1files-1.1core-1.0.0.aar73b4a83ab5e76f20c84a66b1c8444d08 esvaluesvalues.xml:133:5-70: AAPT: error: resource android:attr/fontVariationSettings not found.

C:Usersmmzep.gradlecaches ransforms-1files-1.1core-1.0.0.aar73b4a83ab5e76f20c84a66b1c8444d08 esvaluesvalues.xml:133:5-70:AAPT:错误:资源 android:attr/ttcIndex 未找到.

C:Usersmmzep.gradlecaches ransforms-1files-1.1core-1.0.0.aar73b4a83ab5e76f20c84a66b1c8444d08 esvaluesvalues.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.

C:UsersmmzepDesktopmarioSevenSevenPassengerAppplatformsandroidappuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:95:错误:找不到资源 android:attr/fontVariationSettings.C:UsersmmzepDesktopmarioSevenSevenPassengerAppplatformsandroidappuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:95:错误:找不到资源 android:attr/ttcIndex.错误:链接失败参考文献.

C:UsersmmzepDesktopmarioSevenSevenPassengerAppplatformsandroidappuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:95: error: resource android:attr/fontVariationSettings not found. C:UsersmmzepDesktopmarioSevenSevenPassengerAppplatformsandroidappuildintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:95: error: resource android:attr/ttcIndex not found. error: failed linking references.

执行 aapt 失败

com.android.ide.common.process.ProcessException:执行失败适配

com.android.ide.common.process.ProcessException: Failed to execute aapt

推荐答案

此构建失败是由于 Google Play 服务和 Firebase 库的主要版本发布,于 6 月 17 日发布.

This build failure is due to a major version release of the Google Play Services and Firebase libaries on June 17.

新的库版本有以下要求:

The new library versions have the following requirements:

  • com.android.tools.build:gradle 升级到 v3.2.1 或更高版本.
  • compileSdkVersion 升级到 28 或更高版本.
  • 更新您的应用以使用 Jetpack (AndroidX)
  • Upgrade com.android.tools.build:gradle to v3.2.1 or later.
  • Upgrade compileSdkVersion to 28 or later.
  • Update your app to use Jetpack (AndroidX)

前两个要求可以通过更新为使用 cordova-android@8.0.0 来解决.

The first two requirements can be resolved by updating to use cordova-android@8.0.0.

第三个要求您的 Android 项目迁移到使用 AndroidX (Jetpack).AndroidX 是广泛使用的 Android 支持库.AndroidX 现在被最新版本的 Play Services/Firebase 库使用,而 Support 库被许多现有插件使用,例如 cordova-plugin-firebase.这两个库不能同时存在于同一个 Android 构建中 - 这样做会导致构建失败.

The third requires that your Android project migrates to using AndroidX (Jetpack). AndroidX is the successor to the widely-used Android Support Library. AndroidX now used by the latest versions of Play Services/Firebase libraries and the Support library is used by many existing plugins such as cordova-plugin-firebase. The two libraries cannot live side-by-side in the same Android build - doing so will lead to build failure.

要解决此问题,请在您的 Cordova 项目中添加以下两个插件:

To resolve this issue, add the following two plugins your Cordova project:

  • cordova-plugin-androidx to enable AndroidX in the Android project.
  • cordova-plugin-androidx-adapter to dynamically patch the source code of any plugins using the Support Library to use the AndroidX equivalents.

有关如何在测试项目中试用此功能的工作示例,请参阅 我对这个 Github 问题的评论.

For a working example of how to try this out in a test project, see my comment on this Github issue.

注意:如果您使用的是 cordova-plugin-firebase 并遇到错误,您可以改用 my fork of that plugin 发布为cordova-plugin-firebasex 并已修复以解决新 Firebase SDK 引起的问题:

Note: if you are using cordova-plugin-firebase and encountering errors, you can instead use my fork of that plugin which is published as cordova-plugin-firebasex and is fixed to resolve issues caused by the new Firebase SDK:

rm -Rf platforms/android
cordova plugin rm cordova-plugin-firebase
rm -Rf plugins/ node_modules/
npm install
cordova plugin add cordova-plugin-firebasex
cordova platform add android

这篇关于谷歌 6 月 17 日 Firebase SDK 更新后,Ionic Cordova 应用程序停止编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆