如何使Admob SDK IOS(.xcframework)与Robovm(LibGDX)一起工作?错误:架构的未定义符号ARM64:
我正在尝试在iOS的LibGDX项目上实现Google Admob SDK,当我尝试启动游戏时,我会收到此错误:
[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
我在 gradle
文件中有以下内容:
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 = ""
}
}
我从 : https://develovelinger.google.com/admob/ios/ios/ios/download
这里 取消拉链文件,并将SDK添加到我项目中 iOS
文件夹中的文件夹中。
我在iOS文件夹中创建了 libs
arm_libs sim_libs 。
然后,我将所有.xcframework文件(在我的下载文件夹中)复制并粘贴到 libs
文件夹中。
然后,我从下载文件夹中复制并粘贴 .framework
文件中的 .xcframework
文件夹中的文件夹中 ARMS_LIBS
和 sim_libs
文件夹。
在 info.plist.xml
中,我添加我的ADMOB如下:
<key>GADApplicationIdentifier</key>
<string>ca-app-pub-xxxxxxxxxxxxxxx~xxxxxxxxx</string>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
在 robovm.xml
文件中,我添加以下内容:
<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>
然后我在物理设备中启动(iPhone 8)而且我会收到以下错误:
[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
....
我尝试了许多在网上找到的不同解决方案,但似乎没有什么可用。 任何帮助将不胜感激。谢谢你!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新:
root案例是
com.mobidevelod.robobovm:robopods-google-mobile-mobile-ads-ios
它取决于com.mobidevelod.robobobobobobovm:robopods-google-google-apis-apis-ios
,此伪影包含本地库 libgglcore.a 暴露了这些缺失的依赖性。该图书馆没有资料来源,从2016年起Robovm被MS关闭。
您不应使用这些绑定,因为这些绑定未更新。
考虑使用
alt-pods
作为最近的更新和更新(由我进行)类似的问题,请在Mobivm gitter 通道。
有很少的时刻:
libggladmob.a
或_OBJC_CLASS _ $ _ $ _ $ _ gadinterstitial
。您可以通过二进制文件或在GAD Framework上使用nm
工具来检查此问题;com.mobidevelod.robobovm:robopods-google-mobile-ads-ios
已经过时了。作为根案例,有可能使用错误的框架(例如旧框架)。
作为在这里测试的快速方法是一个示例项目,该项目使用 alt-alt-pods bindings(一般而言,更近的) https://github.com/dkimitsa /alt-pods-tests/tree/master/firebase-google-ads
UPDATE:
root case is
com.mobidevelop.robovm:robopods-google-mobile-ads-ios
it depends oncom.mobidevelop.robovm:robopods-google-apis-ios
and 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 using
alt-pods
as more recent and being updated (by me)similar issue was asked on MobiVM gitter channel.
there are few moments:
libGGLAdMob.a
or_OBJC_CLASS_$_GADInterstitial
. You can check this by searching through binaries or usingnm
tool on GAD framework;com.mobidevelop.robovm:robopods-google-mobile-ads-ios
is 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
在Reddit上找到了解决方案。
移动广告iOS SDK 8+具有破坏性变化,Robopods与此不兼容。
从这里使用SDK 7.42.0
将发布在Reddit上的解决方案的信用 https://www.reddit.com/r/libgdx/comments/ooo32h1/build_error_err_eror_on_ios_updating_to_to_the_latest_version/
Found a solution on reddit.
Mobile Ads IOS sdk 8+ has breaking changes and robopods is not compatible with this.
Use sdk 7.42.0 from here
https://github.com/CocoaPods/Specs/blob/master/Specs/5/9/a/Google-Mobile-Ads-SDK/7.42.2/Google-Mobile-Ads-SDK.podspec.json#L40
Credits to the solution posted on reddit here https://www.reddit.com/r/libgdx/comments/oo32h1/build_error_on_ios_updating_to_the_latest_version/