简体   繁体   English

Eclipse / LibgGdx-如何添加Gradle依赖关系

[英]Eclipse/LibgGdx - How to add a Gradle Dependency

I am creating a LibGdx application for which I would like to add advertisements using Mopub. 我正在创建一个LibGdx应用程序,我想使用Mopub为其添加广告。 I am currently attempting to get it working on iOS and I have tried importing the Mopub Robovm bindings with the source project found here and the compiled jar (that index is not a repo, correct?) as a Gradle dependency, however in both cases I have received this error when deploying: 我目前正在尝试使其在iOS上运行,并且尝试将Mopub Robovm绑定与此处找到的源项目以及已编译的jar (该索引不是存储库,对吗?)作为Gradle依赖项导入,但是在两种情况下,部署时收到此错误:

7/29/14 8:32:24 PM: [ERROR] Undefined symbols for architecture armv7:
7/29/14 8:32:24 PM: [ERROR]   "_OBJC_METACLASS_$_NSManagedObject", referenced from:
7/29/14 8:32:24 PM: [ERROR]       _OBJC_METACLASS_$_CBStory in libmopub.a(CBStory.o)
7/29/14 8:32:24 PM: [ERROR]   "_NSSQLiteStoreType", referenced from:
7/29/14 8:32:24 PM: [ERROR]       -[CBStoryStorageManager persistentStoreCoordinator] in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:24 PM: [ERROR]   "_OBJC_CLASS_$_NSPersistentStoreCoordinator", referenced from:
7/29/14 8:32:24 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:25 PM: [ERROR]   "_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
7/29/14 8:32:25 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:25 PM: [ERROR]   "_OBJC_CLASS_$_NSManagedObject", referenced from:
7/29/14 8:32:25 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:25 PM: [ERROR]       _OBJC_CLASS_$_CBStory in libmopub.a(CBStory.o)
7/29/14 8:32:25 PM: [ERROR]   "_OBJC_CLASS_$_NSAttributeDescription", referenced from:
7/29/14 8:32:25 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:25 PM: [ERROR]   "_OBJC_CLASS_$_NSEntityDescription", referenced from:
7/29/14 8:32:25 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:25 PM: [ERROR]   "_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
7/29/14 8:32:25 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:25 PM: [ERROR]   "_OBJC_CLASS_$_NSFetchRequest", referenced from:
7/29/14 8:32:25 PM: [ERROR]       objc-class-ref in libmopub.a(CBStoryStorageManager.o)
7/29/14 8:32:26 PM: [ERROR] ld: symbol(s) not found for architecture armv7
7/29/14 8:32:26 PM: [ERROR] clang: error: linker command failed with exit code 1 (use -v to see invocation)
7/29/14 8:32:26 PM: [ERROR] Build failed

I think I followed the steps for implementing the source project correctly, but I have no idea if I did the Gradle dependency correctly. 我认为我遵循了正确实现源项目的步骤,但是我不知道我是否正确地执行了Gradle依赖项。 What I did for the dependency was create a folder to hold the mopub-1.0.0-SNAPSHOT.jar and then put this call in the dependency section of the base projects build.gradle file under the iOS section: 我为依赖项所做的工作是创建一个文件夹来保存mopub-1.0.0-SNAPSHOT.jar,然后将此调用放入iOS部分下基础项目build.gradle文件的依赖项部分中:

compile files ("libs/mopub-1.0.0-SNAPSHOT.jar")

If that is not correct, please inform me on the proper method. 如果不正确,请告知我正确的方法。 Thereafter, Eclipse told me to put that local jar on the build path because it was giving build errors, so I did. 此后,Eclipse告诉我将本地jar放在构建路径上,因为它会产生构建错误,所以我做到了。

The code is working, or at least compiling, but how do I actually manage to deploy it (or even to correctly add the jar as a Gradle dependency, if I was doing it incorrectly)? 该代码正在运行,或者至少正在编译,但是我如何真正地进行部署(如果我做错了,甚至正确地将jar作为Gradle依赖项添加)?


EDIT 编辑
I used compile fileTree and this actually put the jar in the Gradle Dependencies, but I'm still getting the error... 我使用了compile fileTree ,这实际上将jar放入了Gradle Dependencies中,但是我仍然遇到错误...

Adding the framework CoreData to my robovm.xml file solved the error! 将框架CoreData添加到我的robovm.xml文件中可以解决该错误! Now I just need to figure out how to send the AdManager (interface made by recommendation of LibGdx "Working with platform-specific code" tutorial) to my main game class, because it can only create the ad in the didFinishLaunching method. 现在,我只需要弄清楚如何将AdManager(由LibGdx推荐的“使用平台特定代码”教程制作的界面)发送到我的主游戏类,因为它只能在didFinishLaunching方法中创建广告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM