Foa*_*Guy 13 android module libgdx android-studio
我正在开发一个使用Universal Tween Engine的Libgdx项目.我已按照此页面上的所有步骤操作:https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine将Universal Tween Engine库安装到我的项目中.
完成所有这些步骤后,项目将在我的笔记本电脑上构建并运行良好(Android和桌面),并且来自补间引擎的动画完美运行.
但是,在我的台式计算机上,每当我尝试运行桌面应用程序时,它都会在TweenAccessor类上抛出NoClassDefFoundException而崩溃,TweenAccessor类是Universal Tween Engine的一部分.应用程序正确编译,我可以按住它,它说它无法找到的类,它打开了该类的源代码,所以我知道至少IDE的某些部分正在找到这个类.源代码编辑器中的任何库类都没有红色下划线错误.有趣的是,在我的桌面计算机上,我可以运行Android应用程序,它不会崩溃,动画效果很好.只有桌面版本不起作用.
在尝试对此进行故障排除时,我已经运行了许多事情,说要切换到"项目"视图找到jar文件,右键单击它们并选择Add as a Library我以前必须在其他项目中执行此操作并且它确实适用于我.
但我的问题是Add as a Library当我在桌面PC上右击它时,上下文菜单中缺少选项:
我试过清理这个项目.我甚至完全卸载Android Studio并下载了一个新副本并安装了它.这样做后仍然得到相同的结果.
在右键单击jar文件时,是什么决定"添加为库"选项是否会显示在上下文菜单中?
我在桌面PC上需要做些什么才能正确使用Universal Tween Engine库jar?
编辑:gradle.build的相关部分.
project(":desktop") {
apply plugin: "java"
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
compile fileTree(dir: '../libs', include: '*.jar') // This one is not listed but I added anyway
}
}
//...
project(":android") {
apply plugin: "android"
configurations { natives }
dependencies {
compile project(":core")
compile "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
compile fileTree(dir: '../libs', include: '*.jar')
}
}
//...
project(":core") {
apply plugin: "java"
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile fileTree(dir: '../libs', include: '*.jar')
}
}
Run Code Online (Sandbox Code Playgroud)
我的项目结构
project_root_dir/
android/
core/
desktop/
html/
ios/
libs/
tween-engine-api.jar
tween-engine-api-sources.jar
Run Code Online (Sandbox Code Playgroud)
我遇到了同样的问题...我这样解决了:只需将 tween.jar 文件添加到 Project 下的 libs 文件夹下,并将其添加到 build.gradle 中
project(":core") {
apply plugin: "java"
dependencies {
compile fileTree(dir: '../libs', include: 'tween-engine-api*.jar')
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
compile "com.badlogicgames.box2dlights:box2dlights:$box2DLightsVersion"
compile "de.tomgrill.gdxfacebook:gdx-facebook-core:1.1.1"
compile "de.tomgrill.gdxdialogs:gdx-dialogs-core:1.0.0"
compile "net.dermetfan.libgdx-utils:libgdx-utils-box2d:0.13.2"
compile "net.dermetfan.libgdx-utils:libgdx-utils:0.13.2"
compile "org.robovm:robopods-google-mobile-ads-ios:1.6.0"
compile "org.robovm:robopods-google-analytics-ios:1.6.0"
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1523 次 |
| 最近记录: |