I am trying to implement google admob sdk on my LibGDX project for iOS, when I try to launch the game I get this error:
[ERROR] 14:44:17.979 Undefined symbols for architecture arm64:
[ERROR] 14:44:17.980 "_OBJC_CLASS_$_GADInterstitial", referenced from:
[ERROR] 14:44:17.981 objc-class-ref in libGGLAdMob.a(GGLContext+AdMob.o)
[ERROR] 14:44:18.114 (maybe you meant: _OBJC_CLASS_$_GADInterstitialAd)
[ERROR] 14:44:18.157 ld: symbol(s) not found for architecture arm64
[ERROR] 14:44:18.180 clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] Couldn't compile app
I have the following in my gradle file:
buildscript {
....
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.15'
//for ads for firebase
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
apply plugin: "eclipse"
version = '1'
ext {
...
gdxVersion = '1.10.0'
roboVMVersion = '2.3.15'
...
}
...
}
project(":ios") {
apply plugin: "java-library"
apply plugin: "robovm"
//publish on app store (iOS)
configurations {natives}
dependencies {
...
//robopods
implementation "com.mobidevelop.robovm:robopods-google-mobile-ads-ios:2.2.3"
}
//publish on app store (iOS)
robovm {
// Configure robovm
iosSignIdentity = "Apple Distribution: XXXXXX XXX (XXXXXXXXX)"
iosProvisioningProfile = "XXXX XXXX"
iosSkipSigning = false
arch = "arm64"
stdoutFifo = ""
stderrFifo = ""
}
}
I downloaded the admob ios SDK from here: https://developers.google.com/admob/ios/download
I unzipped file and added the sdk to folders inside ios folder in my project.
I created libs, arm_libs and sim_libs in the ios folder.
I then copy and pasted all the .xcframework files (in my download folder) into the libs folder.
Then I copy and paste from my download folder the .framework files within the .xcframework folder into the arms_libs and sim_libs folder.
In the Info.plist.xml I add my admob as follows:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxx~xxxxxxxxx</string>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
In the robovm.xml file I add the following:
<frameworkPaths>
<path>libs</path>
<path variant="device">arm_libs</path>
<path variant="simulator">sim_libs</path>
</frameworkPaths>
<frameworks>
....
<!-- googleMobileAdsASKiOS 9.5.0-->
<framework>GoogleAppMeasurement</framework>
<framework>GoogleMobileAds</framework>
<framework>GoogleUtilities</framework>
<framework>nanopb</framework>
<framework>PromisesObjC</framework>
<framework>UserMessagingPlatform</framework>
<framework>GoogleAppMeasurementIdentitySupport</framework>
</frameworks>
Then I launch in my physical device (iPhone 8) and I get the following error:
[ERROR] 14:44:17.979 Undefined symbols for architecture arm64:
[ERROR] 14:44:17.980 "_OBJC_CLASS_$_GADInterstitial", referenced from:
[ERROR] 14:44:17.981 objc-class-ref in libGGLAdMob.a(GGLContext+AdMob.o)
[ERROR] 14:44:18.114 (maybe you meant: _OBJC_CLASS_$_GADInterstitialAd)
[ERROR] 14:44:18.157 ld: symbol(s) not found for architecture arm64
[ERROR] 14:44:18.180 clang: error: linker command failed with exit code 1 (use -v to see invocation)
[ERROR] Couldn't compile app
....
I have tried many different solutions I have found online, but nothing seems to work. Any help would be greatly appreciated. Thank you!
UPDATE: root case is
com.mobidevelop.robovm:robopods-google-mobile-ads-iosit depends oncom.mobidevelop.robovm:robopods-google-apis-iosand this artefact contains native library libGGLCore.a that exposes these missing dependency. There is no source for this library and its from 2016 when RoboVM was closed by MS. You should not use these bindings as these are not updated. Consider usingalt-podsas more recent and being updated (by me)similar issue was asked on MobiVM gitter channel. there are few moments:
libGGLAdMob.aor_OBJC_CLASS_$_GADInterstitial. You can check this by searching through binaries or usingnmtool on GAD framework;com.mobidevelop.robovm:robopods-google-mobile-ads-iosis quite outdated.As a root case there is a chance that wrong framework is used (e.g. old one).
As a quick way to test here is a sample project that uses alt-pods bindings(in general more recent) https://github.com/dkimitsa/alt-pods-tests/tree/master/firebase-google-ads