ammarahm-ed / react-native-admob-native-ads

A simple and robust library for creating & displaying Admob Native Advanced Ads in your React Native App using Native Views.
https://ammarahm-ed.github.io/react-native-admob-native-ads/docs/introduction/
MIT License
407 stars 138 forks source link

Error compiling on Android #311

Closed bricezele closed 1 year ago

bricezele commented 2 years ago

Hello, I'm facing a compilation error since a few days on Android

I have this error:

node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:11: error: cannot find symbol
import com.google.ads.mediation.facebook.FacebookAdapter;
                                        ^
  symbol:   class FacebookAdapter
  location: package com.google.ads.mediation.facebook
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:12: error: cannot find symbol
import com.google.ads.mediation.facebook.FacebookExtras;

  symbol:   class FacebookExtras
  location: package com.google.ads.mediation.facebook
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:84: error: cannot find symbol
        Log.d("LOG_NATIVE_ADS" , FacebookAdapter.class.getName());
                                 ^
  symbol:   class FacebookAdapter
  location: class Utils
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:92: error: cannot find symbol
            Bundle facebookExtras = new FacebookExtras().setNativeBanner(options.getBoolean("nativeBanner")).build();
                                        ^
  symbol:   class FacebookExtras
  location: class Utils
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:93: error: cannot find symbol
            adRequest.addNetworkExtrasBundle(FacebookAdapter.class, facebookExtras);
                                             ^
  symbol:   class FacebookAdapter
  location: class Utils

Does anyone have any idea how to solve this problem?

sainteye commented 2 years ago

Same here. I can build it two days ago. However, today when I rebuild the app. It starts to complain these errors.

node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:11: error: cannot find symbol
import com.google.ads.mediation.facebook.FacebookAdapter;
                                        ^
  symbol:   class FacebookAdapter
  location: package com.google.ads.mediation.facebook
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:12: error: cannot find symbol
import com.google.ads.mediation.facebook.FacebookExtras;
                                        ^
  symbol:   class FacebookExtras
  location: package com.google.ads.mediation.facebook
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:84: error: cannot find symbol
        Log.d("LOG_NATIVE_ADS" , FacebookAdapter.class.getName());
                                 ^
  symbol:   class FacebookAdapter
  location: class Utils
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:92: error: cannot find symbol
            Bundle facebookExtras = new FacebookExtras().setNativeBanner(options.getBoolean("nativeBanner")).build();
                                        ^
  symbol:   class FacebookExtras
  location: class Utils
node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/Utils.java:93: error: cannot find symbol
            adRequest.addNetworkExtrasBundle(FacebookAdapter.class, facebookExtras);
                                             ^
  symbol:   class FacebookAdapter
  location: class Utils
haresh4d commented 2 years ago

Same here yesterday it was compiling today it is showing this error

rohit-dhingra commented 2 years ago

Yeah, I'm facing the same issue

techday84 commented 2 years ago

Me too. Yesterday it works, today it is showing the same error.

mwh1r commented 2 years ago

I don't use the facebook mediation and know little about it - but you can see in their changelog that they have removed the "waterfall integration" from the SDK in 6.12.0.0 which includes some of the code this library is using. The quick solution to get up and running immediately is to use patch-package to fix the com.google.ads.mediation:facebook dependency in build.gradle to the previous version (ie. 6.11.+). The actual solution would be for the community and or maintainers to update the facebook mediation related code in this library - or we could also fix the dependency in the interim.

haresh4d commented 2 years ago

I am also not using Facebook Mediation. How can I remove it from this library? Or How can I use this library without facebook mediation enabled?

sangram37 commented 2 years ago

Yesterday it works, today it is showing the same error.

Hot-key commented 2 years ago

I don't use the facebook mediation and know little about it - but you can see in their changelog that they have removed the "waterfall integration" from the SDK in 6.12.0.0 which includes some of the code this library is using. The quick solution to get up and running immediately is to use patch-package to fix the com.google.ads.mediation:facebook dependency in build.gradle to the previous version (ie. 6.11.+). The actual solution would be for the community and or maintainers to update the facebook mediation related code in this library - or we could also fix the dependency in the interim.

install patch-package

npm i patch-package
# or
yarn add patch-package postinstall-postinstall

Update package.json

// package.json

 "scripts": {
+  "postinstall": "patch-package"
 }

Update node_modules/react-native-admob-native-ads/android/build.gradle:58

// node_modules/react-native-admob-native-ads/android/build.gradle

dependencies {
    implementation 'com.facebook.react:react-native:+'
    implementation "com.google.android.gms:play-services-ads:${safeExtGet('googlePlayServicesAdsVersion', '20.+')}"
    implementation 'com.android.support:support-annotations:28.0.0'
-    implementation 'com.google.ads.mediation:facebook:6.+'
+    implementation 'com.google.ads.mediation:facebook:6.11.+'
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.android.support.constraint:constraint-layout:2.0.4'
}

Run patch-package

npx patch-package react-native-admob-native-ads
# or
yarn patch-package react-native-admob-native-ads
SergiOnGit commented 2 years ago

Same here. @ammarahm-ed should we expect the fix anytime soon?

kabonKoda commented 2 years ago

i couldn’t find a way to use the patch package to get it to work, so i forked the repo and fixed the installed from my repo .....

just npm install https://github.com/kabonKoda/react-native-admob-native-ads

or do the same thing i did till author is ready for us

ammarahm-ed commented 1 year ago

Fixed in v0.6.4.