cordova-plugin-admob-free producing error during build process?
Asked Answered
E

1

5

While building the android app using cordova, i encountered following error log:-

BUILD FAILED in 1m 21s
C:\Users\gagan\Projects\hybrid\framework\error\framework7\quotes\cordova\platforms\android\gradlew: Command failed with exit code 1 Error output:
C:\Users\gagan\Projects\hybrid\framework\error\framework7\quotes\cordova\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;
                              ^
C:\Users\gagan\Projects\hybrid\framework\error\framework7\quotes\cordova\platforms\android\app\src\main\java\name\ratson\cordova\admob\AdMob.java:243: error: cannot find symbol
@NonNull
 ^
symbol:   class NonNull
 location: class AdMob
 2 errors

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

As specified in question, it's occuring due to cordova-plugin-admob-free.How can i remove the error?

Everybody answered 2/5, 2020 at 17:29 Comment(1)
I'm having the same issue, I tried installing cordova-plugin-androidx but still not working :( ... Did you manage to solve your issue ?Laurielaurier
L
8

If anyone is encountering the same issue, I managed to solve it even if the fix is "dirty" but sometimes you just need to be able to build at any costs...

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.

Laurielaurier answered 31/5, 2020 at 14:4 Comment(2)
I didn't solved the error. Instead of it, i uninstalled the plugin as well as androidx and androidx-adapter and then reinstalled it several time. Your solution looks like a promising one. I will mark it as answer for now.Everybody
thanks, works for me. here's the github issue for reference github.com/ionic-team/ionic-cli/issues/4562Kareykari

© 2022 - 2024 — McMap. All rights reserved.