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

Error compiling on Android

bricezele opened this issue · 11 comments

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?

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

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

Yeah, I'm facing the same issue

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

mwh1r commented

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.

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?

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

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

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

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

Fixed in v0.6.4.