...does not satisfy dependency plugin requirement "cordova-plugin-ionic-webview@>=2.0.0"... now android doesn't build

Hey all,

Bit of a long post here.

I always use the same method of doing a fresh build of my app.

Remove /node_module, /platforms, /plugins and then do an npm install.

Next, I do ionic cordova platform add android and then when that completes, I do ionic cordova build android

Today when adding the platform, I got this message:

Failed to install 'cordova-plugin-ionic': CordovaError: Version of installed plugin: "cordova-plugin-ionic-webview@1.2.1" does not satisfy dependency plugin requirement "cordova-plugin-ionic-webview@>=2.0.0". Try --force to use installed plugin as dependency.

So I updated the webview plugin to version 2.0.0 and also updated cordova-android version from 6.3.0 to 6.4.0 as needed by the webview plugin. I also updated cordova-plugin-ionic to ^4.2.0.

Everything else is the same as it always is.

I do ionic cordova platform add android and it works fine.

I do ionic cordova build android and at the very end I get these 3 errors:

/Users/chrisv/.gradle/caches/transforms-1/files-1.1/firebase-iid-16.2.0.aar/b603d65ba3d5865eaa66240d08090b1e/jars/classes.jar(com/google/firebase/iid/FirebaseInstanceId.class): warning: Cannot find annotation method 'value()' in type 'GuardedBy': class file for javax.annotation.concurrent.GuardedBy not found
/Users/chrisv/.gradle/caches/transforms-1/files-1.1/firebase-iid-16.2.0.aar/b603d65ba3d5865eaa66240d08090b1e/jars/classes.jar(com/google/firebase/iid/FirebaseInstanceId.class): warning: Cannot find annotation method 'value()' in type 'GuardedBy'
/Users/chrisv/.gradle/caches/transforms-1/files-1.1/firebase-iid-16.2.0.aar/b603d65ba3d5865eaa66240d08090b1e/jars/classes.jar(com/google/firebase/iid/FirebaseInstanceId.class): warning: Cannot find annotation method 'value()' in type 'GuardedBy'
/Websites/project/platforms/android/src/com/ionicframework/common/IonicCordovaCommon.java:72: error: strings in switch are not supported in -source 1.6

    switch(action) {
          ^
  (use -source 7 or higher to enable strings in switch)
/Websites/project/platforms/android/src/com/ionicframework/common/IonicCordovaCommon.java:144: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
/Websites/project/platforms/android/src/com/ionicframework/common/IonicCordovaCommon.java:201: error: cannot find symbol
    SharedPreferences prefs = this.cordova.getContext().getSharedPreferences("com.ionic.deploy.preferences", Context.MODE_PRIVATE);
                                          ^
  symbol:   method getContext()
  location: variable cordova of type CordovaInterface
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
3 warnings

FAILED

Any one have any ideas? I can’t seem to build anymore and I can’t get past this error.

Here’s my ionic info if it helps:

cli packages: (/usr/local/lib/node_modules)

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

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.11
    Cordova Platforms  : android 6.4.0
    Ionic Framework    : ionic-angular 3.8.0

System:

    ios-deploy : 1.9.2
    ios-sim    : 5.0.6
    Node       : v8.9.1
    npm        : 6.1.0
    OS         : macOS High Sierra
    Xcode      : Xcode 9.4.1 Build version 9F2000

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Thanks for reading, I know it’s a long one.

Same problem here. Solution from another post

cordova plugin rm cordova-plugin-ionic-webview
cordova plugin add cordova-plugin-ionic-webview@latest

delete platform directory

ionic cordova platform add android

Can now build locally and package successfully on ionic pro

2 Likes

Thanks for reply, but didn’t work in this situation. Still the same error.

I am facing the same problem in ionic pro.
The android build fails but the ios build completes.

But locally the android build completes:

Ionic:

   ionic (Ionic CLI)  : 4.0.1 (C:\Users\nowrap\AppData\Roaming\npm\node_modules\i
onic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 6.4.0

System:

   NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.1.0
   OS     : Windows 10

Environment:

   ANDROID_HOME : not set

Same here,

I try with cordova-plugin-ionic-webview@2.0.0

If I not install cordova-plugin-ionic work good.

I contacted the ionic support and got the ionic pro android build working againg:

Hello, yes me too

Ionic:

   ionic (Ionic CLI) : 4.0.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework   : ionic1 1.3.3
   @ionic/v1-toolkit : 1.0.0

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : android 7.1.1, ios 4.5.4

and I create bash script to refresh all platform if you want :

#!/usr/bin/env bash

cd ~/userName/projects/appName/

cordova clean

ionic cordova platform rm ios
ionic cordova platform rm android

plugins=(
    "onesignal-cordova-plugin"
    "cordova-plugin-whitelist"
    "cordova-plugin-ionic"
    "cordova-plugin-statusbar"
    "cordova-plugin-device"
    "ionic-plugin-keyboard"
    "cordova-plugin-transport-security"
    "cordova-plugin-fullscreen"
    "cordova-plugin-splashscreen"
    "cordova-plugin-camera"
    "cordova-plugin-geolocation"
    "cordova-plugin-googlemaps"
    "ionic-plugin-deeplinks"
    "cordova-plugin-facebook4"
    "cordova-plugin-vibration"
    "cordova-plugin-nativeaudio"
    "cordova-plugin-market"
    "cordova-plugin-email-composer"
    "cordova-plugin-inappbrowser"
    "cordova-plugin-queries-schemes"
    "es6-promise-plugin"
    "cordova-plugin-x-socialsharing"
    "cordova-plugin-apprate"
    "cordova-plugin-app-version"
    "cordova-plugin-ionic-webview"
    "com.googlemaps.ios"
   )

for plugin in ${plugins[*]}
do
    ionic cordova plugin rm $plugin --save
done

rm -r plugins

ionic cordova platform add ios@latest --save
ionic cordova platform rm android
ionic cordova platform add android@latest --save

ionic cordova plugin add onesignal-cordova-plugin \
    --save
ionic cordova plugin add cordova-plugin-whitelist \
    --save
ionic cordova plugin add cordova-plugin-ionic \
    --variable APP_ID="YOUR_APP_ID" \
    --variable CHANNEL_NAME="Master" \
    --variable UPDATE_METHOD="background" \
    --save
ionic cordova plugin add cordova-plugin-device \
    --save
ionic cordova plugin add cordova-plugin-transport-security \
    --save
ionic cordova plugin add cordova-plugin-fullscreen \
    --save
ionic cordova plugin add cordova-plugin-splashscreen \
    --save
ionic cordova plugin add cordova-plugin-camera \
    --variable CAMERA_USAGE_DESCRIPTION="APP souhaite accédez à votre camera." \
    --variable PHOTOLIBRARY_USAGE_DESCRIPTION="APP souhaite accédez à votre librairie de photo." \
    --save
ionic cordova plugin add cordova-plugin-geolocation \
    --variable GEOLOCATION_USAGE_DESCRIPTION="APP souhaite connaitre votre position." \
    --save
ionic cordova plugin add cordova-plugin-googlemaps \
     --variable API_KEY_FOR_ANDROID="API_KEY_FOR_ANDROID" \
     --variable API_KEY_FOR_IOS="API_KEY_FOR_IOS" \
     --variable PLAY_SERVICES_VERSION="15.0.1" \
     --variable ANDROID_SUPPORT_V4_VERSION="27.1.0" \
     --variable LOCATION_WHEN_IN_USE_DESCRIPTION="APP souhaite accedez à votre position." \
     --variable LOCATION_ALWAYS_USAGE_DESCRIPTION="APP souhaite accedez à votre position lorsque l'application tourne en tache de fond." \
     --save
ionic cordova plugin add ionic-plugin-deeplinks \
    --variable URL_SCHEME="APPNAME" \
    --variable DEEPLINK_SCHEME="https" \
    --variable DEEPLINK_HOST="hostname.fr" \
    --variable ANDROID_PATH_PREFIX="/" \
    --save
ionic cordova plugin add cordova-plugin-facebook4@2.2.0 \
    --variable APP_ID="FACEBOOK_APP_ID" \
    --variable APP_NAME="FACEBOOK_APP_NAME" \
    --save
ionic cordova plugin add cordova-plugin-vibration \
    --save
ionic cordova plugin add cordova-plugin-nativeaudio \
    --save
ionic cordova plugin add cordova-plugin-market \
    --save
ionic cordova plugin add cordova-plugin-email-composer \
    --save
ionic cordova plugin add cordova-plugin-inappbrowser \
    --save
ionic cordova plugin add cordova-plugin-queries-schemes \
    --save
ionic cordova plugin add es6-promise-plugin \
    --save
ionic cordova plugin add cordova-plugin-x-socialsharing \
    --save
ionic cordova plugin add cordova-plugin-apprate \
    --save
ionic cordova plugin add cordova-plugin-app-version \
    --save
ionic cordova plugin add cordova-plugin-ionic-webview@latest \
    --save

npm install cordova-plugin-statusbar --save
npm install ionic-plugin-keyboard --save
npm uninstall cordova-android --save
npm install cordova-android@latest --save

# add lines in following file
# <string name="fb_app_id">fb_app_id</string>
# <string name="fb_app_name">fb_app_name</string>
vim platforms/android/app/src/main/res/values/strings.xml

I use cordova-check-plugins for updating:
https://www.npmjs.com/package/cordova-check-plugins

1 Like

If you still have this issue, try updating cordova-plugin-ionic to 5.0.2. They just released this update yesterday which works with cordova-android < 7.0.0 which was the issue.

Related github issue:

@ccdex_chris I do not have cordova-plugin-ionic in my plugins list and still have this issue. Cannot figure out what the problem is.