Adding Mobile Ads SDK (C++) to Axmol project

231 views
Skip to first unread message

FHBlah

unread,
Mar 28, 2024, 1:11:15 AM3/28/24
to Google Mobile Ads SDK Developers
Hello, I'd like to integrate the mobile Ads C++ SDK into my Axmol project. Axmol is a fork of the Cocos2d-x, cross-platform, C++ game engine. I've followed these instructions to install the SDK for iOS. My podfile looks like this:

project './build_ios_arm64/AdmobTest.xcodeproj'
platform :ios, '12.2'
use_frameworks!
use_modular_headers!
target 'AdmobTest' do
  pod 'Firebase/CoreOnly'
  pod 'Google-Mobile-Ads-SDK'
  pod 'GoogleUserMessagingPlatform'
end

The resulting framework project wouldn't compile until I added the following to my CMakeLists.txt file, (a fix posted by a fellow Axmol developer who uses cocopods):

if(APPLE)
    if(IOS)
set_target_properties(${APP_NAME} PROPERTIES XCODE_ATTRIBUTE_CONFIGURATION_BUILD_DIR "\${BUILD_DIR}/\$(CONFIGURATION)\$(EFFECTIVE_PLATFORM_NAME)")
    endif()
endif()

After this modification, the project successfully compiled and ran once I added a temporary app ID to my info.plist file. When I added code to initialize the Google Mobile Ads library, I got this error:

firebase::InitResult result;   Use of undeclared identifier 'firebase'

I tried adding the following to import the frameworks there was no change:

#import "firebase.h"
#import "firebase_gma"

I don't have much experience with pods, frameworks, etc. Any procedure you can provide would be greatly appreciated. If successful, I'll be sure to share it with the Axmol community. Thanks!

Environment:

CocoaPods : 1.15.2
Ruby : ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]
RubyGems : 3.0.3.1
Host : macOS 14.2.1 (23C71)
Xcode : 15.1 (15C65)

Mobile Ads SDK Forum Advisor

unread,
Mar 28, 2024, 8:21:53 AM3/28/24
to quizness...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for your inquiry to the Mobile Ads SDK support team.

Kindly be advised that our support channel is best suited to assist with matters related to the implementation of the Google Mobile Ads SDK.

Would you kindly attempt to utilize
#import<FirbaseCore/FIRApp.h>

in place of
#import ‘firebase.h’

Additionally, please execute the command ‘pod install’ in your terminal to install the necessary dependencies. Furthermore, it is recommended that you open your '.xcworkspace' file instead of the '.xcodepro' file.

Could you please confirm whether you are encountering the issues while utilizing the Google Mobile Ads SDK.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02s0Iy6:ref" (ADR-00229029)

Thanks,
 
Google Logo Mobile Ads SDK Team


FHBlah

unread,
Mar 28, 2024, 12:54:42 PM3/28/24
to Google Mobile Ads SDK Developers
Thanks for your response. To answer your question, I'm trying to integrate the Google Mobile Ads C++ SDK as described in the "Get Started" link on this page:

https://developers.google.com/admob/cpp/sdk

At this point, I've successfully initialized and installed the cocoapods, opened the .xcworkspace file, added the firebase and firebase_gma frameworks, built and run the project, and am ready to write the C++ code to initialize the SDK and load ads.

The code you suggested resulted in the following:
#import <FirbaseCore/FIRApp.h>     'FirbaseCore/FIRApp.h' file not found

I was referred to this support channel from Google AdMob Community. Is there a support channel dedicated specifically to the C++ version of the Google Mobile Ads SDK?

Thanks.

Mobile Ads SDK Forum Advisor

unread,
Mar 28, 2024, 2:37:39 PM3/28/24
to quizness...@gmail.com, google-adm...@googlegroups.com

Hi,

Thank you for confirming that you have successfully initialized and installed the cocoapods, opened the .xcworkspace file, added the firebase and firebase_gma frameworks, built and run the project, and you are ready to write the C++ code to initialize the SDK and load ads. 

The next step is to Select an ad format. Kindly refer to our Google cpp sample application as a reference for your implementation. For the firebase::InitResult result; kindly use as below as per the AdMob Migration guide:

using firebase::App;
using firebase::Future;
using firebase::gma::AdapterInitializationStatus;

I hope this helps! Let me know if you have any other questions. 

Reply all
Reply to author
Forward
0 new messages