Ionic Cordova app stopped compiling after Google&#

2020-01-25 05:38发布

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

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

This is my ionic info:

@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

This is the error I'm Getting:

: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: 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: 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.

Failed to execute aapt

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

10条回答
太酷不给撩
2楼-- · 2020-01-25 06:32

I suggest you to try to add in your build-extras.gradle, inside the platform/android folder of your project this:

configurations.all {
    resolutionStrategy {
         force 'com.android.support:support-v4:27.1.1'
         force 'com.google.android.gms:play-services-tagmanager:16.0.8'
         force 'com.google.android.gms:play-services-base:16.1.0'
         force 'com.google.android.gms:play-services-tasks:16.0.1'
         force 'com.google.android.gms:play-services-basement:16.2.0'
         force 'com.google.android.gms:play-services-gcm:16.1.0'
         force 'com.google.android.gms:play-services-stats:16.0.1'
         force 'com.google.android.gms:play-services-location:16.0.0'
         force 'com.google.android.gms:play-services-auth:16.0.1'
         force 'com.google.android.gms:play-services-identity:16.0.0'
    }
}

In this way you will force the build command to ignore the updates and to use the previous versions. You don't even need to change any plugin (nor the android platform version)!

Every time firebase's libs are updated this happens.. and it is very annoying. I'd love to be able to turn off the auto dependency update on build command, but I don't think it is possible.

查看更多
劳资没心,怎么记你
3楼-- · 2020-01-25 06:34

Here are the exact steps I did to fix

cordova build android

delete platforms folder

ionic cordova platform remove android
ionic cordova plugin remove cordova-plugin-firebase
ionic cordova plugin add cordova-plugin-firebase-lib@3.3.0
ionic cordova plugin add cordova-plugin-androidx-adapter
cordova build android
ionic cordova platform add android
cordova plugin add cordova-plugin-whitelist
ionic cordova emulate
查看更多
Fickle 薄情
4楼-- · 2020-01-25 06:36

1. First Answer

We have created a PR for this https://github.com/wizpanda/cordova-plugin-firebase-lib/pull/13 but that requires upgrade of cordova-android to 8.0.0.

A workaround is being done for cordova-android 7.x but meanwhile, a discussion is also ongoing whether to keep support for it or not.

2. Edit - Jun 19, 2019

A new version v3.3.0 is released to fix the issue caused by Google Firebase release which supports cordova-android <= 7.1.4. https://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

3. Edit - Jun 20, 2019

A new version v4.0.1 is released to fix the issue caused by Google Firebase release which supports cordova-android >= 8.0.0. https://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
查看更多
【Aperson】
5楼-- · 2020-01-25 06:37

Having in platform/android/project.properties following settings :

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:+

I had the same issue (error: resource android:attr/ttcIndex not found).

cordova-android@8.0.0 + cordova-plugin-androidx + cordova-plugin-androidx-adapter worked for me perfectly.

Thanks for this solution.

I am just wondering if it is a good long time bet to use those two plugins. Any opinion ?

查看更多
登录 后发表回答