Google在6月17日更新Firebase SDK后,Ionic Cordova应用程序停止了编译 [英] Ionic Cordova app stopped compiling after Google's June 17th Firebase SDK update
问题描述
在Firebase主要版本更新后,尤其是2019年6月17日更新之后,我无法编译Ionic Cordova App.
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:\Development\android-sdk
Misc:
backend : pro
这是我遇到的错误:
: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.
: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: error: resource android:attr/fontVariationSettings not found.
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.gradle\caches\transforms-1\files-1.1\core-1.0.0.aar\73b4a83ab5e76f20c84a66b1c8444d08\res\values\values.xml:133:5-70: AAPT: error: resource android:attr/ttcIndex not found.
C:\ Users \ mmzep \ Desktop \ mario \ Seven \ SevenPassengerApp \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:95: 错误:找不到资源android:attr/fontVariationSettings. C:\ Users \ mmzep \ Desktop \ mario \ Seven \ SevenPassengerApp \ platforms \ android \ app \ build \ intermediates \ incremental \ mergeDebugResources \ merged.dir \ values \ values.xml:95: 错误:找不到资源android:attr/ttcIndex.错误:链接失败 参考.
C:\Users\mmzep\Desktop\mario\Seven\SevenPassengerApp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:95: error: resource android:attr/fontVariationSettings not found. C:\Users\mmzep\Desktop\mario\Seven\SevenPassengerApp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.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
推荐答案
此构建失败是由于新库版本具有以下要求:
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 是广泛使用的
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 可以在Android项目中启用AndroidX.
- cordova-plugin-androidx-adapter 可以动态地修补任何使用支持库使用AndroidX等效项的插件.
- 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.
For a working example of how to try this out in a test project, see my comment on this Github issue.
注意:如果您使用的是 cordova-plugin-firebase 并遇到错误,您可以改为使用我的该插件的分叉 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
这篇关于Google在6月17日更新Firebase SDK后,Ionic Cordova应用程序停止了编译的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!