-
-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error while updating property 'mediaView' of a view managed by:RNGADNativeView null the specified child already has a parent. You must call removeView() on the child's parent first. #287
Comments
critical issue please reply fast |
@deepakkumar089551 Share complete crash details from adb logcat. and it would be best if you can provide an example repository where i can test and fix it soon. |
@ammarahm-ed Hi Ammar I think I'm having same problem please resolve my issue I have already created issue. |
@rakeshp947 if you can provide an example that can reproduce the issue, i will look into fixing it. |
@ammarahm-ed I already provided you the complete logs, please have a look - here |
@ammarahm-ed Any update on this?? |
Did anyone find solution for this? I am currently getting the crash: It's occuring very frequently for an high percentage of the app users. |
any update? |
work for me @Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
// Add this
if(this != null){
this.removeAllViews();
}
} |
any update? |
I generated a release version and installed it only on my phone, I did some tests and realized that the app crashes only when the ad is a video, when it renders an image, it works fine. Using NativeMediaView of course, I can't show a capture or anything like that because this only happens in production, Mr. @luongminh2410dev solution didn't work for me, unfortunately! Complete log: Exception com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'mediaview' of a view managed by: RNGADNativeView |
@lean098
My patch-package: diff --git a/node_modules/react-native-admob-native-ads/android/build.gradle b/node_modules/react-native-admob-native-ads/android/build.gradle
index be307ad..c6a9c5b 100755
--- a/node_modules/react-native-admob-native-ads/android/build.gradle
+++ b/node_modules/react-native-admob-native-ads/android/build.gradle
@@ -55,7 +55,7 @@ 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'
}
\ No newline at end of file
diff --git a/node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/RNAdmobMediaView.java b/node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/RNAdmobMediaView.java
index d489ecf..2254f61 100644
--- a/node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/RNAdmobMediaView.java
+++ b/node_modules/react-native-admob-native-ads/android/src/main/java/com/ammarahmed/rnadmob/nativeads/RNAdmobMediaView.java
@@ -62,7 +62,9 @@ public class RNAdmobMediaView extends MediaView {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
-
+ if(this != null){
+ this.removeAllViews();
+ }
}
@Override
diff --git a/node_modules/react-native-admob-native-ads/ios/RNAdMobManager/RNAdMobUnifiedAdQueueWrapper.m b/node_modules/react-native-admob-native-ads/ios/RNAdMobManager/RNAdMobUnifiedAdQueueWrapper.m
index 2f4724a..21d86e1 100644
--- a/node_modules/react-native-admob-native-ads/ios/RNAdMobManager/RNAdMobUnifiedAdQueueWrapper.m
+++ b/node_modules/react-native-admob-native-ads/ios/RNAdMobManager/RNAdMobUnifiedAdQueueWrapper.m
@@ -75,7 +75,7 @@ -(instancetype)initWithConfig:(NSDictionary *)config repo:(NSString *)repo{
//Set request options
if ([config objectForKey:@"adChoicesPlacement"]){
- [adPlacementOptions setPreferredAdChoicesPosition:((NSNumber *)[config objectForKey:@"adChoicesPlacement"]).intValue];
+ [adPlacementOptions setPreferredAdChoicesPosition: GADAdChoicesPositionTopRightCorner];
}
if ([config objectForKey:@"mediaAspectRatio"]){
[adMediaOptions setMediaAspectRatio:((NSNumber *)[config objectForKey:@"mediaAspectRatio"]).intValue];
diff --git a/node_modules/react-native-admob-native-ads/react-native-admob-native-ads.podspec b/node_modules/react-native-admob-native-ads/react-native-admob-native-ads.podspec
index 7b92e8e..5c9e7d4 100755
--- a/node_modules/react-native-admob-native-ads/react-native-admob-native-ads.podspec
+++ b/node_modules/react-native-admob-native-ads/react-native-admob-native-ads.podspec
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
# So instead we add the default location of the framework to the framework
# search paths, and we rely on consumers of this library to add
# Google-Mobile-Ads-SDK as a direct dependency.
- s.weak_frameworks = 'GoogleMobileAds', 'FacebookAdapter'
+ s.weak_frameworks = 'GoogleMobileAds', 'MetaAdapter'
s.pod_target_xcconfig = {
'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/Google-Mobile-Ads-SDK/Frameworks/**" '\
'"$(PODS_ROOT)/FBAudienceNetwork/**" '\
@@ -27,4 +27,5 @@ Pod::Spec.new do |s|
}
s.dependency 'React-Core'
+ s.dependency 'Google-Mobile-Ads-SDK', '~>9.12.0'
end |
@luongminh2410dev Thanks man, I'll update my apps according to your patch |
Fixed in v0.7.5. @luongminh2410dev Thanks for the fix. |
when second time open same page then show error-
error while updating property 'mediaView' of a view managed by:RNGADNativeView
null the specified child already has a parent.
You must call removeView() on the child's parent first.
The text was updated successfully, but these errors were encountered: