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

requestNonPersonalizedAdsOnly #369

Closed zoobibackups closed 5 months ago

zoobibackups commented 6 months ago

Error in while updating property requestNonPersonalizedAdsOnly of a view managed by ::RNGADNativeView null No Virtual Method { "name": "ARDrawing", "version": "0.0.1", "private": true, "scripts": { "dev": "npx react-native run-android", "iphone": "npx react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest" }, "dependencies": { "@react-native-async-storage/async-storage": "^1.23.1", "@react-native-camera-roll/camera-roll": "^7.7.0", "@react-native-community/slider": "^4.5.2", "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@reduxjs/toolkit": "^2.2.3", "@types/react-native-torch": "^1.1.2", "lottie-react-native": "^6.7.2", "patch-package": "^8.0.0", "postinstall-postinstall": "^2.1.0", "react": "18.2.0", "react-native": "0.73.5", "react-native-admob-native-ads": "^0.6.6", "react-native-gesture-handler": "^2.16.1", "react-native-google-mobile-ads": "^13.2.1", "react-native-image-picker": "^7.1.2", "react-native-onboarding-swiper": "^1.2.0", "react-native-permissions": "^4.1.5", "react-native-responsive-fontsize": "^0.5.1", "react-native-responsive-screen": "^1.4.2", "react-native-safe-area-context": "^4.10.1", "react-native-screens": "^3.31.1", "react-native-splash-screen": "^3.3.0", "react-native-svg": "^15.2.0", "react-native-toast-notifications": "^3.4.0", "react-native-torch": "^1.2.0", "react-native-vector-icons": "^10.1.0", "react-native-virtualized-view": "^1.0.0", "react-native-vision-camera": "^4.0.1", "react-redux": "^9.1.2", "redux": "^5.0.1", "redux-persist": "^6.0.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/babel-preset": "0.73.21", "@react-native/eslint-config": "0.73.2", "@react-native/metro-config": "0.73.5", "@react-native/typescript-config": "0.73.1", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", "prettier": "2.8.8", "react-native-svg-transformer": "^1.3.0", "react-test-renderer": "18.2.0", "typescript": "5.0.4" }, "engines": { "node": ">=18" } }

AJAY172003 commented 6 months ago

I am also getting the same error in android. If anybody have solution so please comment urgently

AJAY172003 commented 6 months ago

This issue is solved by downgrading the google-ads-sdk.I had downgraded the version from 23 to 22.6 in android

HarunNdogo commented 6 months ago

I have the same problem on Expo. How do I solve this

Nikhil-stan commented 5 months ago

I am also facing the same issue in android. If anybody have solution so please comment urgently

zoobibackups commented 5 months ago

I am also getting the same error in android. If anybody have solution so please comment urgently

go to node modules react native Admob native ads and Open android src java and RNAdmobUnifies files and comment the lines of requestNonPersonalizedAdsOnly and rebuild the solve the issue

owaisansarii commented 5 months ago

I am also facing the same issue in android. If anybody have solution so please comment urgently

Hi, this isn't working. Has anyone else found a solution?

cddceo commented 5 months ago

I solved. But It's not a perfect solution I think.

node_modules/react-native-admob-native-ads/android/src/main/java/Utils.java

change to below data

public static void setRequestNonPersonalizedAdsOnly(boolean npa, AdManagerAdRequest.Builder adRequest) {
    // Bundle extras = new Bundle();
    // if (npa) {
    //     extras.putString("npa", "1");
    // } else {
    //     extras.putString("npa", "0");
    // }
    // adRequest.addNetworkExtrasBundle(AdMobAdapter.class, extras);

}