Ionic Cordova app stopped compiling after Google's June 17th Firebase SDK update

后端 未结 10 1456
花落未央
花落未央 2020-11-28 06:54

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 An

10条回答
  •  孤城傲影
    2020-11-28 07:40

    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:

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

    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
    

提交回复
热议问题