Solution 1 :
In node-modules/react-native-admob/android/build.gradle
replace ====> implementation ‘com.google.android.gms:play-services-ads:+.’
With ====> implementation ‘com.google.android.gms:play-services-ads:19.8.0’
Hope this will solve your issue
Solution 2 :
Install the beta version instead…
yarn add [email protected]
Don’t forget to delete your node-modules folder, and clean your build folder as a precaution
Problem :
I’m trying to add admob to my project, but when installed, my project can’t install on my phone, does anyone know what it might be?
error bellow
Configure project :react-native-admob
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’.
It will be removed soon. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3)> Resolve dependencies of :react-native-screens:debugCompileClasspath
for Android Gradle Plugin 3.5.3.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove “buildToolsVersion ‘23.0.1’” from your build.gradle file, as each version of the Android Gradle
Plugin now has a default version of the build tools.
Task :react-native-gesture-handler:compileDebugJavaWithJavac
Task :react-native-reanimated:compileDebugJavaWithJavac
Task :react-native-admob:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
40 actionable tasks: 38 executed, 2 up-to-date
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.
Note: C:Users55419DesktopMyApp2node_modulesreact-native-reanimatedandroidsrcmainjavacomswmansionreanimatedNodesMana
ger.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:Users55419DesktopMyApp2node_modulesreact-native-reanimatedandroidsrcmainjavacomswmansionreanimatedNodesMana
ger.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:Users55419DesktopMyApp2node_modulesreact-native-admobandroidsrcmainjavacomsbugertrnadmobRNAdMobRewardedVideoAdMod
ule.java:20: error: RNAdMobRewardedVideoAdModule is not abstract and does not override abstract method onRewardedVideoCompleted()
in RewardedVideoAdListener
public class RNAdMobRewardedVideoAdModule extends ReactContextBaseJavaModule implements RewardedVideoAdListener {
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task ‘:react-native-admob: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. Run with –scan to
get full insights. -
Get more help at https://help.gradle.org
BUILD FAILED in 22s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/envi
ronment-setup. Run CLI with –verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Comments
Comment posted by Hend El-Sahli
What version of react-native-admob you have in package.json ?
Comment posted by BigFoot Programmer
version 1.3.2 in package.json