Google在6月17日更新Firebase SDK后,Ionic Cordova应用程序停止了编译

Mar*_*eda 26 android cordova firebase ionic-framework ionic3

在Firebase主要版本更新后,尤其是2019年6月17日更新之后,我无法编译Ionic Cordova App。

我尝试降级到Android Cordova 6.3.0,但我的项目必须为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:\Development\android-sdk

Misc:

    backend : pro
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

:app:processDebugResources C:\ Users \ mmzep.gradle \ caches \ transforms-1 \ files-1.1 \ core-1.0.0.aar \ 73b4a83ab5e76f20c84a66b1c8444d08 \ res \ values \ values.xml:133:5-70:AAPT:错误:找不到资源android:attr / fontVariationSettings。

C:\ Users \ mmzep.gradle \ caches \ transforms-1 \ files-1.1 \ core-1.0.0.aar \ 73b4a83ab5e76f20c84a66b1c8444d08 \ res \ values \ values.xml:133:5-70:AAPT:错误:资源android:找不到attr / ttcIndex。

C:\ Users \ mmzep \ Desktop \ mario \ Seven \ SevenPassengerApp \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:95:错误:资源android:attr / fontVariationSettings not找到了。C:\ Users \ mmzep \ Desktop \ mario \ Seven \ SevenPassengerApp \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:95:错误:资源android:attr / ttcIndex不找到了。错误:链接引用失败。

无法执行Aapt

com.android.ide.common.process.ProcessException:无法执行aapt

Dav*_*den 43

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:

  • 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)

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

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.

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

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

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
Run Code Online (Sandbox Code Playgroud)


Sha*_*wal 8

1.第一个答案

我们已经为此https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/13创建了PR,但这需要升级cordova-android8.0.0

一种解决方法正在针对cordova-android7.x 进行,但与此同时,有关是否继续为其提供支持的讨论也在进行中。

2.编辑-2019年6月19日

已发布新版本的v3.3.0,以修复由支持的Google Firebase版本引起的问题cordova-android <= 7.1.4https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/14#issuecomment-503499409

cordova plugin remove cordova-plugin-firebase-lib
# Or if you were using original fork
#cordova plugin remove cordova-plugin-firebase
cordova plugin add cordova-plugin-firebase-lib@3.3.0
Run Code Online (Sandbox Code Playgroud)

3.编辑-2019年6月20日

已发布新版本v4.0.1,以修复由支持的Google Firebase版本引起的问题cordova-android >= 8.0.0https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/14#issuecomment-503499409

cordova plugin remove cordova-plugin-firebase-lib
# Or if you were using original fork
#cordova plugin remove cordova-plugin-firebase
cordova plugin add cordova-plugin-firebase-lib
Run Code Online (Sandbox Code Playgroud)


小智 5

在platform / android / project.properties中具有以下设置:

cordova.gradle.include.1=cordova-plugin-firebase/app-build.gradle
cordova.system.library.4=com.google.firebase:firebase-core:+
cordova.system.library.5=com.google.firebase:firebase-messaging:+
cordova.system.library.6=com.google.firebase:firebase-config:+
cordova.system.library.7=com.google.firebase:firebase-perf:+
Run Code Online (Sandbox Code Playgroud)

我遇到了同样的问题(错误:找不到资源android:attr / ttcIndex)。

cordova-android@8.0.0 + cordova-plugin-androidx + cordova-plugin-androidx-adapter非常适合我。

感谢您的解决方案。

我只是想知道使用这两个插件是否是一个好时机。有什么意见吗?


小智 5

按照以下顺序进行cordova-android <= 7.1.4

cordova平台删除android
cordova插件删除cordova-plugin-
firebase
cordova 插件添加cordova-plugin-firebase-lib@3.3.0 cordova平台添加android

cordova-plugin-firebase-lib现在包含了cordova-plugin-firebase