Closed frazahmedd closed 8 months ago
@frazahmedd got stuck with same issue, passing down temp fix. Worked for me!
Using RN version 0.73.2
and react-native-google-mobile-ads version 12.10.0
with new architecture
Update this file: node_modules/react-native-google-mobile-ads/RNGoogleMobileAds.podspec
Copy contents from below:
require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
google_mobile_ads_sdk_version = package['sdkVersions']['ios']['googleMobileAds']
google_ump_sdk_version = package['sdkVersions']['ios']['googleUmp']
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
ios_platform = new_arch_enabled ? '11.0' : '9.0'
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
Pod::Spec.new do |s|
s.name = "RNGoogleMobileAds"
s.version = package["version"]
s.description = package["description"]
s.summary = <<-DESC
#{package["description"]}
DESC
s.homepage = "http://invertase.io/oss/react-native-google-mobile-ads"
s.license = package['license']
s.authors = "Invertase Limited"
s.source = { :git => "#{package["repository"]["url"]}.git", :tag => "v#{s.version}" }
s.social_media_url = 'http://twitter.com/invertaseio'
s.ios.deployment_target = ios_platform
s.source_files = "ios/**/*.{h,m,mm,swift}"
s.weak_frameworks = "AppTrackingTransparency"
s.platforms = { :ios => ios_platform }
s.dependency "React-Core"
# Don't install the dependencies when we run `pod install` in the old architecture.
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"${PODS_ROOT}/Headers/Private/Yoga\"",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
}
s.dependency "React-RCTFabric"
s.dependency "React-Codegen"
s.dependency "RCT-Folly"
s.dependency "RCTRequired"
s.dependency "RCTTypeSafety"
s.dependency "ReactCommon/turbomodule/core"
end
# Other dependencies
if defined?($RNGoogleUmpSDKVersion)
Pod::UI.puts "#{s.name}: Using user specified Google UMP SDK version '#{$RNGoogleUmpSDKVersion}'"
google_ump_sdk_version = $RNGoogleUmpSDKVersion
end
if !ENV['MAC_CATALYST']
s.dependency 'GoogleUserMessagingPlatform', google_ump_sdk_version
end
if defined?($RNGoogleMobileAdsSDKVersion)
Pod::UI.puts "#{s.name}: Using user specified Google Mobile-Ads SDK version '#{$RNGoogleMobileAdsSDKVersion}'"
google_mobile_ads_sdk_version = $RNGoogleMobileAdsSDKVersion
end
# AdMob dependencies
if !ENV['MAC_CATALYST']
s.dependency 'Google-Mobile-Ads-SDK', google_mobile_ads_sdk_version
end
if defined?($RNGoogleMobileAdsAsStaticFramework)
Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNGoogleMobileAdsAsStaticFramework}'"
s.static_framework = $RNGoogleMobileAdsAsStaticFramework
else
s.static_framework = false
end
end
and in your react-native.config.js
file in root of your project, add this:
module.exports = {
project: {
ios: {
unstable_reactLegacyComponentNames: ['RNGoogleMobileAdsBannerView'],
},
},
};
Since, I'm only using BannerView
so I've added that, feel free to add more components there if needed.
Hello 👋, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
What happened?
I am working on react native CLI My app is working fine but as soon as i install this library "npm i react-native-google-mobile-ads" and then this "cd ios" and then "pod install" then i get 2 errors
1- Invoke detect_changes_with_podfile patched method (this shows up immediately) after at the end I get this **2-[!] The following Swift pods cannot yet be integrated as static libraries:
The Swift pod
RNGoogleMobileAds
depends uponglog
, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may setuse_modular_headers!
globally in your Podfile, or specify:modular_headers => true
for particular dependencies.**And in addition to this if i run "pod install" after pasting "use_modular_headers!" on the top in podfile and save it then I get this "[!] CocoaPods could not find compatible versions for pod "RCT-Folly": In snapshot (Podfile.lock): RCT-Folly (from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
)In Podfile: RCT-Folly (from
../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
)It seems like you've changed the version of the dependency
RCT-Folly
and it differs from the version stored inPods/Local Podspecs
. You should runpod update RCT-Folly --no-repo-update
to apply changes made locally."and then after that when i run
pod update RCT-Folly --no-repo-update
then i get this error "[!] CocoaPods could not find compatible versions for pod "boost": In snapshot (Podfile.lock): boost (from../node_modules/react-native/third-party-podspecs/boost.podspec
)In Podfile: boost (from
../node_modules/react-native/third-party-podspecs/boost.podspec
)It seems like you've changed the version of the dependency
boost
and it differs from the version stored inPods/Local Podspecs
. You should runpod update boost --no-repo-update
to apply changes made locally."and when i run
pod update boost --no-repo-update
i get the RCT-Folly again its just keeps on repeating in a loopi literally needs to run ads on my app but stuck on this for the previous 6 days
Platforms
Only on iOS
React Native Info
Are your using Typescript?
package.json
app.json
ios/Podfile
android/build.gradle
android/app/build.gradle
android/settings.gradle
AndroidManifest.xml