AdMob.java:243: error: cannot find symbol

Table of Contents

AdMob.java:243: error: cannot find symbol

[cordova] D:\sync\websvr\ionic\test\reader\envirotech_book_reader_mobile\platforms\android\app\src\main\java\name\ratson\cordova\admob\AdMob.java:243: error: cannot find symbol
[cordova]     @NonNull
[cordova]      ^
[cordova]   symbol:   class NonNull
[cordova]   location: class name.ratson.cordova.admob.AdMob
[cordova] Note: Some input files use or override a deprecated API.
[cordova] Note: Recompile with -Xlint:deprecation for details.
[cordova] 4 errors
[cordova]
[cordova] FAILURE: Build failed with an exception.
[cordova]
[cordova] * What went wrong:
[cordova] Execution failed for task ':app:compileDebugJavaWithJavac'.
[cordova] > Compilation failed; see the compiler error output for details.
[cordova]
[cordova] * Try:
[cordova] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[cordova]
[cordova] * Get more help at https://help.gradle.org

You need to modify platforms/android/app/src/main/java/name/ratson/cordova/admob/AdMob.java file.

Replace line 5 of file:

import android.support.annotation.NonNull;

by

import androidx.annotation.NonNull;

You'll also need cordova-plugin-androidx plugin to be installed.

cordova plugin add cordova-plugin-androidx

image


Leave a Reply

Your email address will not be published. Required fields are marked *