我正在尝试使用libGDX将Eclipse项目导入Android Studio。 我的项目有多个库依赖项。 我的结构如下: androidLib1 - > androidLib2 - > appProject
我没有将libGDX用于多平台,所以在Eclipse中我将所有资源添加到我的androidLib1中。 我需要所有的库和项目都熟悉libGDX资源。
在eclipse中它很棒。但是在Android Studio中,一旦我运行应用程序并启动libGDX活动,我就会收到此异常:
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx' for target: Linux, 32-bit
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:117)
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:34)
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ at com.badlogic.gdx.backends.android.AndroidFragmentApplication.<clinit>(AndroidFragmentApplication.java:48)
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ ... 19 more
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gdx: findLibrary returned null
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ at java.lang.Runtime.loadLibrary(Runtime.java:365)
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ at java.lang.System.loadLibrary(System.java:535)
11-27 13:49:26.170 14721-14721/? E/RPC-﹕ at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:113)
我认为由于某种原因,androidLib2和appProject没有以某种方式与gdx.jar链接。哪个androidLib1也链接了。如果我尝试将appProject链接到gdx.jar,我会收到重复资源或类似内容的编译错误。
注意,gdx.jar是一个java jar ...
任何人都知道如何让它发挥作用?
感谢。
添加了项目gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14+'
}
}
allprojects {
version = '1.0'
ext {
gdxVersion = '1.3.1'
roboVMVersion = '1.0.0-alpha-04'
box2DLightsVersion = '1.3'
ashleyVersion = '1.3.1'
aiVersion = '1.3.1'
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
}
}
project(":androidLib1") {
apply plugin: 'android-library'
configurations { natives }
dependencies {
compile "com.badlogicgames.gdx:gdx:$gdxVersion"
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
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"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
}
}