如何使Admob SDK IOS(.xcframework)与Robovm(LibGDX)一起工作?错误:架构的未定义符号ARM64:

发布于 2025-02-02 20:02:08 字数 3873 浏览 5 评论 0 原文

我正在尝试在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
....

我尝试了许多在网上找到的不同解决方案,但似乎没有什么可用。 任何帮助将不胜感激。谢谢你!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぺ禁宫浮华殁 2025-02-09 20:02:08

更新:
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 通道。
有很少的时刻:

  • firebase.zip(9.3.0)包含Google-mobile-ads-sdk 9.7.0都没有引用 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 on com.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:

  • Firebase.zip (9.3.0) that contains Google-Mobile-Ads-SDK 9.7.0 has no references either to libGGLAdMob.a or _OBJC_CLASS_$_GADInterstitial. You can check this by searching through binaries or using nm 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

森罗 2025-02-09 20:02:08

在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/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文