compileDebugJavaWithJavac Faild when use ionic with admob cordova plugin

when i use admob cordova plugin and build android app it’s give me this error


i tried and remove the plugin and reinstall it dose not work
and also remove all android platform and re added it dose not work

Are you using https://ionicframework.com/docs/native/admob/?

No, I’m use admob free

So https://ionicframework.com/docs/native/admob-free/?

Yes this is what I used now

i’m still cannot solve this error , after i change the whole project and build android project an i’m still get this error

:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).


D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMob.java:192: error: cannot find symbol

            builder.setIsDesignedForFamilies(true);
                   ^
  symbol:   method setIsDesignedForFamilies(boolean)
  location: variable builder of type Builder

D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMob.java:194: error: cannot find symbol
            builder.setIsDesignedForFamilies(false);

                   ^


  symbol:   method setIsDesignedForFamilies(boolean)

  location: variable builder of type Builder

D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMobConfig.java:206: error: cannot find symbol


            return AdSize.FLUID;

                         ^
  symbol:   variable FLUID

  location: class AdSize


D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMobConfig.java:208: error: cannot find symbol

            return AdSize.SEARCH;

                         ^


  symbol:   variable SEARCH

  location: class AdSize


Note: D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\org\apache\cordova\splashscreen\SplashScreen.java uses or overrides a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

4 errors


:compileDebugJavaWithJavac
FAILED



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.


>
Compilation failed; see the compiler error output for details.



* Try:

Run with
--stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.



BUILD FAILED


Total time: 15.299 secs


Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMob.java:192: error: cannot find symbol
            builder.setIsDesignedForFamilies(true);
                   ^
  symbol:   method setIsDesignedForFamilies(boolean)
  location: variable builder of type Builder
D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMob.java:194: error: cannot find symbol
            builder.setIsDesignedForFamilies(false);
                   ^
  symbol:   method setIsDesignedForFamilies(boolean)
  location: variable builder of type Builder
D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMobConfig.java:206: error: cannot find symbol
            return AdSize.FLUID;
                         ^
  symbol:   variable FLUID
  location: class AdSize
D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\name\ratson\cordova\admob\AdMobConfig.java:208: error: cannot find symbol
            return AdSize.SEARCH;
                         ^
  symbol:   variable SEARCH
  location: class AdSize
Note: D:\Assests for Programming\Projects\Ionic Train\AdTesingNew\platforms\android\src\org\apache\cordova\splashscreen\SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Picked up _JAVA_OPTIONS: -Xmx512M

I’m having the same issue
I had to build locally - because IONIC build service always failed (I don’t know why)
anyway , try to install/update these packages in your Android SDK Manager
image