ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
499 stars 214 forks source link

admob/AdMob.java:243: error: cannot find symbol @NonNull #432

Closed Kaz- closed 3 years ago

Kaz- commented 3 years ago

I'm encountering an issue while trying to build my Ionic 3 app for Android with this plugin.

While I try to build I get this Android build error:

/Users/Kaz/lab/my-app/platforms/android/app/src/main/java/name/ratson/cordova/admob/AdMob.java:5: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
                                 ^
/Users/Kaz/lab/my-app/platforms/android/app/src/main/java/name/ratson/cordova/admob/AdMob.java:243: error: cannot find symbol
    @NonNull
     ^
  symbol:   class NonNull
  location: class AdMob

Here's my ionic info :

Ionic:

   Ionic CLI          : 6.9.3 (/Users/Kaz/.nvm/versions/node/v12.14.1/lib/node_modules/@ionic/cli)
   Ionic Framework    : ionic-angular 3.9.5
   @ionic/app-scripts : 3.2.4

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 8.1.0, browser 6.0.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-webview 1.2.1, (and 15 other plugins)

Utility:

   cordova-res : 0.14.0
   native-run  : 1.0.0

System:

   ios-sim : 8.0.2
   NodeJS  : v12.14.1 (/Users/Kaz/.nvm/versions/node/v12.14.1/bin/node)
   npm     : 6.13.4
   OS      : macOS Catalina
   Xcode   : Xcode 11.4.1 Build version 11E503a

I searched and found some people having the same issue, here's what I already tried:

Any ideas on how to solve this issue ?

ffmiranda commented 3 years ago

Try replace android.support.annotation.NonNull; to androidx.annotation.NonNull;

Kaz- commented 3 years ago

It worked like a charm. Thanks !