我在LibGDX中有一款游戏(在iOS版中与Android Studio完美配合)但没有广告。
我已经按照太多的教程来添加Admob,但是我尝试的所有内容都得到了相同的结果:
我的build.gradle文件:
dependencies {
//classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.3-SNAPSHOT'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.2.1-SNAPSHOT'
}
(我已尝试过使用2.3.3和2.2.1)
ext {
appName = "xxxxxx"
gdxVersion = '1.9.7'
roboVMVersion = '2.2.1-SNAPSHOT'
robopodsVersion = '2.2.1'
box2DLightsVersion = '1.4'
ashleyVersion = '1.7.0'
aiVersion = '1.8.0'
}
(我也用gdxVersion 1.9.0测试过)
和ios项目依赖项
project(":ios") {
apply plugin: "java"
apply plugin: "robovm"
dependencies {
compile project(":core")
compile "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
compile "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
compile "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-ios"
compile "com.mobidevelop.robovm:robopods-google-mobile-ads-ios:$robopodsVersion"
}}
我还将此添加到robovm.xml:
<frameworkPaths>
<path>libs</path>
</frameworkPaths>
<frameworks>
<framework>GoogleMobileAds</framework>
</frameworks>
最后,我已将 GoogleMobileAds.framework 添加到我的ios / build / libs文件夹
当我开始通过添加BannerAdView来修改IOSLauncher类时,它会抛出以下错误
public class IOSLauncher extends IOSApplication.Delegate {
private GADBannerView adview;
错误:
Error:(13, 13) error: cannot find symbol class GADBannerView
我做错了什么? 有人遇到过同样的问题吗?
提前致谢
巴勃罗
答案 0 :(得分:1)
Finally, I have added GoogleMobileAds.framework to my ios/build/libs folder
You have to put GoogleMobileAds.framework folder to 'ios/libs/' folder and not to 'ios/build/libs/' folder. So you have to create a new 'libs' folder and put it in 'ios/' folder. Path for the Google Mobile Ads framework should be: "ios/libs/GoogleMobileAds.framework"
答案 1 :(得分:1)
我解决了我的问题
我所要做的就是刷新所有gradle项目,让这些库下载
感谢所有人!