Skip to content
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

No such module 'google_mobile_ads' in iOS native code(Flutter plugin) #603

Closed
andj207 opened this issue Jul 10, 2022 · 10 comments
Closed

No such module 'google_mobile_ads' in iOS native code(Flutter plugin) #603

andj207 opened this issue Jul 10, 2022 · 10 comments
Labels
bug Something isn't working e2-days Effort: < 5 days native ad Issues related to Native Ad p3-low platform-ios iOS applications specifically

Comments

@andj207
Copy link

andj207 commented Jul 10, 2022

Plugin Version

google_mobile_ads: ^1.3.0

Steps to Reproduce

I create a Flutter plugin for Admob to reuse in my different projects for banner, interstitial, native ad and rewarded ads. I create it so that I can just add the plugin to other project's pubspec.yaml and use without recode or copy/paste every time.

It works fine on Android native code, the "google_mobile_ads" sdk is recognized and can be accessed without adding any dependency.

But, the problem is that the google_mobile_ads is not recognized in my iOS code (to create the Native Ad Factory) when Run Build in Xcode. When I use "Ctrl + Click" the "FLTNativeAdFactory" class to "Jump to Definition" in Xcode, it works but the build fail with the error. See the attached image.

Here is my code and setup:

  • admob_ads plugin pubspec.yaml
    admob_ads plugin pubspec.yaml

  • the ios code podspec

Pod::Spec.new do |s|
  s.name             = 'admob_ads'
  s.version          = '0.0.1'
  s.summary          = 'A new Flutter plugin project.'
  s.description      = <<-DESC
A new Flutter plugin project.
                       DESC
  s.homepage         = 'http://example.com'
  s.license          = { :file => '../LICENSE' }
  s.author           = { 'Your Company' => 'email@example.com' }
  s.source           = { :path => '.' }
  s.source_files = 'Classes/**/*'
  s.dependency 'Flutter'
  s.dependency 'Cosmos', '~> 23.0'
  s.platform = :ios, '9.0'

  # Flutter.framework does not contain a i386 slice.
  s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'i386' }
  s.swift_version = '5.0'
end
  • The ios code tree and error when build:
    enter image description here

Please help!

@maheshj01 maheshj01 added the in triage Issue currently being evaluated label Jul 11, 2022
@maheshj01
Copy link
Collaborator

Hi @andj207, Thanks for filing the issue. To investigate the issue further I would need a minimal and complete sample project.

@maheshj01 maheshj01 added the feedback required Further information is requested label Jul 11, 2022
@andj207
Copy link
Author

andj207 commented Jul 11, 2022

Hi @maheshmnj here is the minimal and complete sample project. This is a flutter plugin project.

admobads_sample_plugin.zip

Edit: Please run the "admobads_sample_plugin/example/lib/main.dart" to see the error on iOS but work well on Android.

@github-actions github-actions bot removed the feedback required Further information is requested label Jul 11, 2022
@maheshj01
Copy link
Collaborator

Thanks for the sample project @andj207, I am able to reproduce the same error, I don't really have much expertise on the native IOS, But from the error it looks like the google_mobile_ads sdk is not getting imported in the plugin, Hence the error.
Also as per this codelab the config looks correct.

logs
Launching lib/main.dart on iPhone 12 Pro in debug mode...
Warning: Missing build name (CFBundleShortVersionString).
Warning: Missing build number (CFBundleVersion).
Action Required: You must set a build name and number in the pubspec.yaml file version field before submitting to the App Store.
Xcode build done.                                            2.9s
Failed to build iOS app
Error output from Xcode build:
↳
    objc[15330]: Class AMSupportURLConnectionDelegate is implemented in both /usr/lib/libamsupport.dylib (0x209b1f640) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1061442c8). One of the two will be used. Which one is undefined.
    objc[15330]: Class AMSupportURLSession is implemented in both /usr/lib/libamsupport.dylib (0x209b1f690) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x106144318). One of the two will be used. Which one is undefined.
    objc[15330]: Class AppleTypeCRetimerRestoreInfoHelper is implemented in both /usr/lib/libauthinstall.dylib (0x209b1f458) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1061444f8). One of the two will be used. Which one is undefined.
    objc[15330]: Class AppleTypeCRetimerFirmwareAggregateRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x209b1f4a8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x106144548). One of the two will be used. Which one is undefined.
    objc[15330]: Class AppleTypeCRetimerFirmwareRequestCreator is implemented in both /usr/lib/libauthinstall.dylib (0x209b1f4f8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x106144598). One of the two will be used. Which one is undefined.
    objc[15330]: Class ATCRTRestoreInfoFTABFile is implemented in both /usr/lib/libauthinstall.dylib (0x209b1f548) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x1061445e8). One of the two will be used. Which one is undefined.
    objc[15330]: Class AppleTypeCRetimerFirmwareCopier is implemented in both /usr/lib/libauthinstall.dylib (0x209b1f598) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x106144638). One of the two will be used. Which one is undefined.
    objc[15330]: Class ATCRTRestoreInfoFTABSubfile is implemented in both /usr/lib/libauthinstall.dylib (0x209b1f5e8) and /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/MobileDevice (0x106144688). One of the two will be used. Which one is undefined.
    ** BUILD FAILED **
Xcode's output:
↳
    Writing result bundle at path:
    	/var/folders/yt/1smr9dys1kj3p28q05l7nzy00000gp/T/flutter_tools.4dTTbl/flutter_ios_build_temp_dirSKcmjF/temporary_xcresult_bundle
    /Users/mahesh/Downloads/admobads_sample_plugin 2/ios/Classes/AdmobNativeAdFactory.swift:3:8: error: no such module 'google_mobile_ads'
    import google_mobile_ads
           ^
    /Users/mahesh/Downloads/admobads_sample_plugin 2/ios/Classes/AdmobNativeAdFactory.swift:3:8: error: no such module 'google_mobile_ads'
    import google_mobile_ads
           ^
    /Users/mahesh/Downloads/admobads_sample_plugin 2/ios/Classes/AdmobNativeAdFactory.swift:3:8: error: no such module 'google_mobile_ads'
    import google_mobile_ads
           ^
    /Users/mahesh/Downloads/admobads_sample_plugin 2/ios/Classes/AdmobNativeAdFactory.swift:3:8: error: no such module 'google_mobile_ads'
    import google_mobile_ads
           ^
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    Result bundle written to path:
    	/var/folders/yt/1smr9dys1kj3p28q05l7nzy00000gp/T/flutter_tools.4dTTbl/flutter_ios_build_temp_dirSKcmjF/temporary_xcresult_bundle
Swift Compiler Error (Xcode): No such module 'google_mobile_ads'
/Users/mahesh/Downloads/admobads_sample_plugin%202/ios/Classes/AdmobNativeAdFactory.swift:2:7
Could not build the application for the simulator.
Error launching application on iPhone 12 Pro.
Exited

Labeling this issue for further insights from the team, Sample project can be found here #603 (comment)

cc: @jjliu15

@maheshj01 maheshj01 added bug Something isn't working p3-low e2-days Effort: < 5 days platform-ios iOS applications specifically native ad Issues related to Native Ad and removed in triage Issue currently being evaluated labels Jul 15, 2022
@dtvtkien
Copy link

dtvtkien commented Oct 11, 2022

@andj207 Have you found the solution? I have the same problem with you when I tried to create an Admob plugin for my apps. For me, I used google_mobile_ads: ^2.0.1 version.

@andj207
Copy link
Author

andj207 commented Oct 11, 2022

@dtvtkien No, I'm still waiting for a fix. Currently I have to remove native ad type, just use other ads types or have to use google_mobile_ads in the main project code instead of in a plugin.

@lmmartinb
Copy link

@andj207 do you have any update or workaround? Thanks in advance

@DaeHyeonNam
Copy link

I solved it by using Runner.xcworkspace instead of Runner.xcodeproj file.
Hope it solves your problem too.

@Blast06
Copy link

Blast06 commented Apr 8, 2023

I solved it by using Runner.xcworkspace instead of Runner.xcodeproj file. Hope it solves your problem too.

I dont get it @DaeHyeonNam , what do you mean by "Using" Runner.xcworkspace instead of Runner.xcodeproj file ?

@DaeHyeonNam
Copy link

@Blast06 Have you tried to build the application using Runner.xcworkpsace? My error came up only when I tried to build using Runner.xcodeproj.

@huycozy
Copy link
Collaborator

huycozy commented Jul 21, 2023

We’re closing this issue due to inactivity. If you’re still impacted, please create a new issue via the Developer Forum.

@huycozy huycozy closed this as not planned Won't fix, can't repro, duplicate, stale Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working e2-days Effort: < 5 days native ad Issues related to Native Ad p3-low platform-ios iOS applications specifically
Projects
None yet
Development

No branches or pull requests

7 participants