libgdx - android问题 - "不幸的是[app name]已停止"

时间:2015-06-16 22:16:56

标签: java android libgdx tween

很抱歉,如果我做了一件非常愚蠢的事情,或者这是一个愚蠢的问题,但是你可能会告诉我对编程很陌生,所以任何帮助都会非常感激!

我可以在我的桌面上运行我的libgdx游戏就好了,但是当我尝试在我的Android手机或genymotion上运行它时,我会得到一个弹出窗口,表示"不幸的是,[app name]已停止&# 34。

这里是LogCat中的错误(很遗憾很长):



06-16 15:44:06.228: E/EGL_genymotion(125): Failed to establish connection with the host
06-16 15:44:06.236: E/eglCodecCommon(125): TcpStream::connect() - connect() errno=111
06-16 15:44:06.236: E/(125): Failed to connect to host (TcpStream)!!!
06-16 15:44:06.236: E/gralloc_vbox86(125): gralloc: Failed to get host connection
06-16 15:44:06.236: E/SurfaceFlinger(125): hwcomposer module not found
06-16 15:44:06.236: E/SurfaceFlinger(125): ERROR: failed to open framebuffer (I/O error), aborting
06-16 15:44:11.308: E/setdpi(194): Setting DPI to 480
06-16 15:44:11.312: E/SurfaceFlinger(184): hwcomposer module not found
06-16 15:44:11.548: E/MonoPipe(186): Failed to fetch local time frequency when constructing a MonoPipe (res = -32).  getNextWriteTimestamp calls will be non-functional
06-16 15:44:12.012: E/memtrack(185): Couldn't load memtrack module (No such file or directory)
06-16 15:44:12.012: E/android.os.Debug(185): failed to load memtrack module: -2
06-16 15:44:12.136: E/local_camera(121): We have a problem with the player connection 0 (Success)
06-16 15:44:12.720: E/EmojiFactory_jni(185): Failed to load libemoji.so: dlopen failed: library "libemoji.so" not found
06-16 15:44:14.012: E/Netd(183): exec() res=0, status=768 for /system/bin/iptables -t nat -N oem_nat_pre 
06-16 15:44:14.036: E/Netd(183): exec() res=0, status=768 for /system/bin/iptables -t nat -A PREROUTING -j oem_nat_pre 
06-16 15:44:14.120: E/Netd(183): exec() res=0, status=768 for /system/bin/iptables -t nat -N natctrl_nat_POSTROUTING 
06-16 15:44:14.140: E/Netd(183): exec() res=0, status=768 for /system/bin/iptables -t nat -A POSTROUTING -j natctrl_nat_POSTROUTING 
06-16 15:44:14.172: E/Netd(183): exec() res=0, status=768 for /system/bin/iptables -t nat -N st_nat_POSTROUTING 
06-16 15:44:14.192: E/Netd(183): exec() res=0, status=768 for /system/bin/iptables -t nat -A POSTROUTING -j st_nat_POSTROUTING 
06-16 15:44:15.900: E/ConsumerIrService(504): Can't open consumer IR HW Module, error: -2
06-16 15:44:15.904: E/libsuspend(504): Error opening /sys/power/autosleep: Permission denied
06-16 15:44:15.904: E/libsuspend(504): Error opening /sys/power/wakeup_count: Permission denied
06-16 15:44:15.904: E/libsuspend(504): failed to initialize autosuspend
06-16 15:44:15.956: E/EventHub(504): could not get driver version for /dev/input/mouse1, Not a typewriter
06-16 15:44:15.984: E/EventHub(504): could not get driver version for /dev/input/mouse0, Not a typewriter
06-16 15:44:16.016: E/EventHub(504): could not get driver version for /dev/input/mice, Not a typewriter
06-16 15:44:16.088: E/MobileDataStateTracker(504): default: Ignoring feature request because could not acquire PhoneService
06-16 15:44:16.088: E/MobileDataStateTracker(504): default: Could not enable APN type "default"
06-16 15:44:16.264: A/SystemServer(504): BOOT FAILURE making Package Manager Service ready
06-16 15:44:16.264: A/SystemServer(504): java.lang.SecurityException: Unable to find app for caller android.app.ActivityThread$ApplicationThread@529520c0 (pid=504) when registering receiver android.app.LoadedApk$ReceiverDispatcher$InnerReceiver@52906730
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.server.am.ActivityManagerService.registerReceiver(ActivityManagerService.java:13021)
06-16 15:44:16.264: A/SystemServer(504): 	at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1458)
06-16 15:44:16.264: A/SystemServer(504): 	at android.app.ContextImpl.registerReceiverAsUser(ContextImpl.java:1433)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:84)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.server.pm.UserManagerService.systemReady(UserManagerService.java:237)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.server.pm.PackageManagerService.systemReady(PackageManagerService.java:10602)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.server.ServerThread.initAndLoop(SystemServer.java:903)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.server.SystemServer.main(SystemServer.java:1189)
06-16 15:44:16.264: A/SystemServer(504): 	at java.lang.reflect.Method.invokeNative(Native Method)
06-16 15:44:16.264: A/SystemServer(504): 	at java.lang.reflect.Method.invoke(Method.java:515)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
06-16 15:44:16.264: A/SystemServer(504): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
06-16 15:44:16.264: A/SystemServer(504): 	at dalvik.system.NativeStart.main(Native Method)
06-16 15:44:16.272: E/libsuspend(504): Error opening /sys/power/autosleep: Permission denied
06-16 15:44:16.272: E/libsuspend(504): Error opening /sys/power/wakeup_count: Permission denied
06-16 15:44:16.272: E/libsuspend(504): failed to initialize autosuspend
06-16 15:44:16.388: E/EGL_genymotion(504): egl: current context mark for deletion
06-16 15:44:16.536: E/WVMExtractor(186): Failed to open libwvm.so
06-16 15:44:16.696: E/BluetoothAdapter(568): Bluetooth binder is null
06-16 15:44:16.696: E/BluetoothAdapter(568): Bluetooth binder is null
06-16 15:44:16.708: E/BluetoothAdapter(568): Bluetooth binder is null
06-16 15:44:16.740: E/BluetoothAdapter(568): Bluetooth binder is null
06-16 15:44:16.784: E/BluetoothAdapter(568): Bluetooth binder is null
06-16 15:44:16.896: E/WifiStateMachine(504): Failed to reload STA firmware java.lang.IllegalArgumentException: command '2 softap fwreload eth1 STA' failed with '501 2 SoftAP command has failed'
06-16 15:44:16.896: E/NetdConnector(504): NDC Command {1 bandwidth enable} took too long (604ms)
06-16 15:44:16.924: E/OpenGLRenderer(568): Getting MAX_TEXTURE_SIZE from GradienCache
06-16 15:44:16.932: E/OpenGLRenderer(568): MAX_TEXTURE_SIZE: 16384
06-16 15:44:16.932: E/OpenGLRenderer(568): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
06-16 15:44:16.936: E/OpenGLRenderer(568): MAX_TEXTURE_SIZE: 16384
06-16 15:44:17.036: E/WifiHW(504): Unable to open connection to supplicant on "@android:wpa_eth1": No such file or directory
06-16 15:44:17.284: E/BluetoothAdapter(648): Bluetooth binder is null
06-16 15:44:17.564: E/FlpHardwareProvider(504): Error hw_get_module 'flp': -2
06-16 15:44:17.564: E/FlpHardwareProvider(504): Error hw_get_module 'flp': -2
06-16 15:44:17.564: E/LocationManagerService(504): no geocoder provider found
06-16 15:44:17.564: E/LocationManagerService(504): No FusedProvider found.
06-16 15:44:17.564: E/LocationManagerService(504): no geofence provider found
06-16 15:44:17.568: E/BluetoothAdapter(648): Bluetooth binder is null
06-16 15:44:17.672: E/GpsLocationProvider(504): no AGPS interface in set_agps_server
06-16 15:44:18.144: E/BluetoothAdapter(648): Bluetooth binder is null
06-16 15:44:18.192: E/GpsLocationProvider(504): no AGPS interface in set_agps_server
06-16 15:44:18.296: E/BluetoothAdapter(697): Bluetooth binder is null
06-16 15:44:18.320: E/BluetoothAdapter(697): Bluetooth binder is null
06-16 15:44:18.324: E/BluetoothAdapter(697): Bluetooth binder is null
06-16 15:44:18.328: E/BluetoothAdapter(648): Bluetooth binder is null
06-16 15:44:18.592: E/memtrack(678): Couldn't load memtrack module (No such file or directory)
06-16 15:44:18.596: E/android.os.Debug(678): failed to load memtrack module: -2
06-16 15:44:18.976: E/gralloc_vbox86(184): gralloc_alloc: Mismatched usage flags: 1080 x 1920, usage b33
06-16 15:44:18.976: E/(184): GraphicBufferAlloc::createGraphicBuffer(w=1080, h=1920) failed (Invalid argument), handle=0x0
06-16 15:44:18.976: E/BufferQueue(184): [ScreenshotSurface] dequeueBuffer: SurfaceComposer::createGraphicBuffer failed
06-16 15:44:19.192: E/BluetoothAdapter(648): Bluetooth binder is null
06-16 15:44:19.312: E/WifiConfigStore(504): Error parsing configurationjava.io.FileNotFoundException: /data/misc/wifi/ipconfig.txt: open failed: ENOENT (No such file or directory)
06-16 15:44:19.312: E/wpa_supplicant(647): Line -1: too long model_name (len=46 max_len=32)
06-16 15:44:19.312: E/wpa_supplicant(647): Line -1: failed to parse 'model_name=Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920'.
06-16 15:44:19.312: E/WifiStateMachine(504): Failed to set model name Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920
06-16 15:44:19.312: E/wpa_supplicant(647): Line -1: too long model_number (len=46 max_len=32)
06-16 15:44:19.312: E/wpa_supplicant(647): Line -1: failed to parse 'model_number=Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920'.
06-16 15:44:19.312: E/WifiStateMachine(504): Failed to set model number Samsung Galaxy S5 - 4.4.4 - API 19 - 1080x1920
06-16 15:44:19.340: E/WifiStateMachine(504): Failed to set frequency band 0
06-16 15:44:19.480: E/WifiStateMachine(504): Unexpected BatchedScanResults :null
06-16 15:44:19.824: E/OpenGLRenderer(710): Getting MAX_TEXTURE_SIZE from GradienCache
06-16 15:44:19.824: E/OpenGLRenderer(710): MAX_TEXTURE_SIZE: 16384
06-16 15:44:19.836: E/OpenGLRenderer(710): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
06-16 15:44:19.836: E/OpenGLRenderer(710): MAX_TEXTURE_SIZE: 16384
06-16 15:44:21.068: E/ConnectivityService(504): Unexpected mtu value: android.net.wifi.WifiStateTracker@5294512c
06-16 15:44:21.644: E/NetdConnector(504): NDC Command {29 bandwidth setiquota eth0 9223372036854775807} took too long (601ms)
06-16 15:44:21.644: E/NetdConnector(504): NDC Command {30 resolver setifdns eth1 home 192.168.1.1} took too long (578ms)
06-16 15:44:21.824: E/ConnectivityService(504): Unexpected mtu value: android.net.wifi.WifiStateTracker@5294512c
06-16 15:44:22.016: E/BluetoothAdapter(504): Bluetooth binder is null
06-16 15:44:22.016: E/BluetoothAdapter(504): Bluetooth binder is null
06-16 15:44:25.531: E/memtrack(1206): Couldn't load memtrack module (No such file or directory)
06-16 15:44:25.535: E/android.os.Debug(1206): failed to load memtrack module: -2
06-16 15:44:26.095: E/OpenGLRenderer(1220): Getting MAX_TEXTURE_SIZE from GradienCache
06-16 15:44:26.099: E/OpenGLRenderer(1220): MAX_TEXTURE_SIZE: 16384
06-16 15:44:26.107: E/OpenGLRenderer(1220): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
06-16 15:44:26.107: E/OpenGLRenderer(1220): MAX_TEXTURE_SIZE: 16384
06-16 15:44:26.299: E/EGL_genymotion(1220): [getAttribValue] Bad attribute idx
06-16 15:44:26.299: E/EGL_genymotion(1220): tid 1235: eglGetConfigAttrib(576): error 0x3004 (EGL_BAD_ATTRIBUTE)
06-16 15:44:26.299: E/EGL_genymotion(1220): [getAttribValue] Bad attribute idx
06-16 15:44:26.299: E/EGL_genymotion(1220): tid 1235: eglGetConfigAttrib(576): error 0x3004 (EGL_BAD_ATTRIBUTE)
06-16 15:44:26.503: E/Utils(186):  Couldn't map mime type "audio/x-pcm" to a valid AudioSystem::audio_format !
06-16 15:44:26.519: A/SoftFFmpegAudio(186): external/stagefright-plugins/libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp:1100 CHECK(isConfigured()) failed.
06-16 15:44:26.519: A/libc(186): Fatal signal 4 (SIGILL) at 0xb76e363d (code=2), thread 1242 (peg.pcm.decoder)
06-16 15:44:26.575: E/dalvikvm(1220): Could not find class 'com.kilobolt.TweenAccessors.SpriteAccessor', referenced from method com.kilobolt.screens.SplashScreen.setupTween
06-16 15:44:26.575: E/AndroidRuntime(1220): FATAL EXCEPTION: GLThread 72
06-16 15:44:26.575: E/AndroidRuntime(1220): Process: com.kilobolt.zombiebird.android, PID: 1220
06-16 15:44:26.575: E/AndroidRuntime(1220): java.lang.NoClassDefFoundError: com.kilobolt.TweenAccessors.SpriteAccessor
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at com.kilobolt.screens.SplashScreen.setupTween(SplashScreen.java:47)
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at com.kilobolt.screens.SplashScreen.show(SplashScreen.java:42)
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at com.badlogic.gdx.Game.setScreen(Game.java:61)
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at com.kilobolt.zombiebird.ZBGame.create(ZBGame.java:11)
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
06-16 15:44:26.575: E/AndroidRuntime(1220): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
06-16 15:44:26.827: E/local_camera(121): We have a problem with the hw connection 0 (Success)
06-16 15:44:26.827: E/local_camera(120): We have a problem with the hw connection 0 (Success)
06-16 15:44:26.831: E/SoundPool(1220): Unable to load sample: (null)
06-16 15:44:26.831: E/SoundPool(1220): Unable to load sample: (null)
06-16 15:44:26.831: E/SoundPool(1220): Unable to load sample: (null)
06-16 15:44:26.831: E/SoundPool(1220): Unable to load sample: (null)
06-16 15:44:26.831: E/AudioService(504): Media server died.
06-16 15:44:26.911: E/MonoPipe(1249): Failed to fetch local time frequency when constructing a MonoPipe (res = -32).  getNextWriteTimestamp calls will be non-functional
06-16 15:44:27.331: E/AudioService(504): Media server started.
06-16 15:44:28.911: E/BluetoothAdapter(648): Bluetooth binder is null
06-16 15:44:43.043: E/InputDispatcher(504): channel '529532ec com.kilobolt.zombiebird.android/com.kilobolt.zombiebird.android.AndroidLauncher (server)' ~ Channel is unrecoverably broken and will be disposed!
06-16 15:51:30.763: E/memtrack(1436): Couldn't load memtrack module (No such file or directory)
06-16 15:51:30.763: E/android.os.Debug(1436): failed to load memtrack module: -2
06-16 15:51:31.107: E/memtrack(1446): Couldn't load memtrack module (No such file or directory)
06-16 15:51:31.107: E/android.os.Debug(1446): failed to load memtrack module: -2
06-16 15:51:32.019: E/OpenGLRenderer(1459): Getting MAX_TEXTURE_SIZE from GradienCache
06-16 15:51:32.019: E/OpenGLRenderer(1459): MAX_TEXTURE_SIZE: 16384
06-16 15:51:32.027: E/OpenGLRenderer(1459): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
06-16 15:51:32.027: E/OpenGLRenderer(1459): MAX_TEXTURE_SIZE: 16384
06-16 15:51:32.255: E/EGL_genymotion(1459): [getAttribValue] Bad attribute idx
06-16 15:51:32.255: E/EGL_genymotion(1459): tid 1474: eglGetConfigAttrib(576): error 0x3004 (EGL_BAD_ATTRIBUTE)
06-16 15:51:32.255: E/EGL_genymotion(1459): [getAttribValue] Bad attribute idx
06-16 15:51:32.255: E/EGL_genymotion(1459): tid 1474: eglGetConfigAttrib(576): error 0x3004 (EGL_BAD_ATTRIBUTE)
06-16 15:51:32.519: E/WVMExtractor(1249): Failed to open libwvm.so
06-16 15:51:32.627: E/Utils(1249):  Couldn't map mime type "audio/x-pcm" to a valid AudioSystem::audio_format !
06-16 15:51:32.635: A/SoftFFmpegAudio(1249): external/stagefright-plugins/libstagefright/codecs/ffmpegdec/adec/SoftFFmpegAudio.cpp:1100 CHECK(isConfigured()) failed.
06-16 15:51:32.639: A/libc(1249): Fatal signal 4 (SIGILL) at 0xb76b563d (code=2), thread 1487 (peg.pcm.decoder)
06-16 15:51:32.675: E/dalvikvm(1459): Could not find class 'com.kilobolt.TweenAccessors.SpriteAccessor', referenced from method com.kilobolt.screens.SplashScreen.setupTween
06-16 15:51:32.687: E/AndroidRuntime(1459): FATAL EXCEPTION: GLThread 96
06-16 15:51:32.687: E/AndroidRuntime(1459): Process: com.kilobolt.zombiebird.android, PID: 1459
06-16 15:51:32.687: E/AndroidRuntime(1459): java.lang.NoClassDefFoundError: com.kilobolt.TweenAccessors.SpriteAccessor
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at com.kilobolt.screens.SplashScreen.setupTween(SplashScreen.java:47)
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at com.kilobolt.screens.SplashScreen.show(SplashScreen.java:42)
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at com.badlogic.gdx.Game.setScreen(Game.java:61)
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at com.kilobolt.zombiebird.ZBGame.create(ZBGame.java:11)
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241)
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1512)
06-16 15:51:32.687: E/AndroidRuntime(1459): 	at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
06-16 15:51:33.203: E/local_camera(1251): We have a problem with the hw connection 0 (Success)
06-16 15:51:33.207: E/SoundPool(1459): Unable to load sample: (null)
06-16 15:51:33.207: E/SoundPool(1459): Unable to load sample: (null)
06-16 15:51:33.207: E/SoundPool(1459): Unable to load sample: (null)
06-16 15:51:33.207: E/SoundPool(1459): Unable to load sample: (null)
06-16 15:51:33.207: E/AudioService(504): Media server died.
06-16 15:51:33.207: E/local_camera(1250): We have a problem with the hw connection 0 (Success)
06-16 15:51:33.279: E/MonoPipe(1495): Failed to fetch local time frequency when constructing a MonoPipe (res = -32).  getNextWriteTimestamp calls will be non-functional
06-16 15:51:33.707: E/AudioService(504): Media server started.
06-16 15:51:40.603: E/InputDispatcher(504): channel '529dca00 com.kilobolt.zombiebird.android/com.kilobolt.zombiebird.android.AndroidLauncher (server)' ~ Channel is unrecoverably broken and will be disposed!




正如你在我的logcat中看到的那样,它表示"致命异常"是GLThread 96,但我不确定那是多么相关。

配置代码是



package com.kilobolt.zombiebird.android;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.kilobolt.zombiebird.ZBGame;

public class AndroidLauncher extends AndroidApplication {
	@Override
	protected void onCreate (Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
		initialize(new ZBGame(), config);
	}
}




ZBGame.java的代码



package com.kilobolt.zombiebird;

import com.badlogic.gdx.Game;
import com.kilobolt.screens.SplashScreen;
import com.kilobolt.zbhelpers.AssetLoader;

public class ZBGame extends Game{
	@Override
	public void create() {
		 AssetLoader.load();
		 setScreen(new SplashScreen(this));
	}

    @Override
    public void dispose() {
        super.dispose();
        AssetLoader.dispose();
    }
}




这非常令人费解,因为游戏在桌面上运行时的运行方式正是如此。我也使用Tween并且它涉及到logcat中的一些错误,但在查看我的代码之后我不认为Tween是它无法工作的原因,因为我的Tween代码看起来很完美并且没有错误。

如果有一条重要的信息,我只是告诉我,我会发布信息,我一直试图解决这个问题三天,我很想解决它。谢谢你的帮助。

编辑: 看来问题出在我的程序设置上 问题似乎与我的gradle有关,它应该是不同的。在https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine它声明    "找到标记为项目的部分(":core")     在依赖项部分添加以下行:compile fileTree(dir:' ../ libs',include:' * .jar')"

但是我的格斗中没有这样的部分存在。这是我的gradle文件的代码



android {
    buildToolsVersion "20.0.0"
    compileSdkVersion 20
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['libs']
        }

        instrumentTest.setRoot('tests')
    }
}


// called every time gradle gets executed, takes the native dependencies of
// the natives configuration, and extracts them to the proper libs/ folders
// so they get packed with the APK.
task copyAndroidNatives() { 
    file("libs/armeabi/").mkdirs();
    file("libs/armeabi-v7a/").mkdirs();
    file("libs/x86/").mkdirs();

    configurations.natives.files.each { jar ->
        def outputDir = null
        if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")
        if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
        if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
        if(outputDir != null) {
            copy {
                from zipTree(jar)
                into outputDir
                include "*.so"
            }
        }
    }
}

task run(type: Exec) {
    def path
    def localProperties = project.file("../local.properties")
    if (localProperties.exists()) {
        Properties properties = new Properties()
        localProperties.withInputStream { instr ->
            properties.load(instr)
        }
        def sdkDir = properties.getProperty('sdk.dir')
        if (sdkDir) {
            path = sdkDir
        } else {
            path = "$System.env.ANDROID_HOME"
        }
    } else {
        path = "$System.env.ANDROID_HOME"
    }

    def adb = path + "/platform-tools/adb"
    commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.kilobolt.zombiebird.android/com.kilobolt.zombiebird.android.AndroidLauncher'
}

// sets up the Android Eclipse project, using the old Ant based build.
eclipse {
    // need to specify Java source sets explicitely, SpringSource Gradle Eclipse plugin
    // ignores any nodes added in classpath.file.withXml
    sourceSets {
        main {
            java.srcDirs "src", 'gen'
        }
    }

    jdt {
        sourceCompatibility = 1.6
        targetCompatibility = 1.6
    }

    classpath {
        plusConfigurations += [ project.configurations.compile ]        
        containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'       
    }

    project {
        name = appName + "-android"
        natures 'com.android.ide.eclipse.adt.AndroidNature'
        buildCommands.clear();
        buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
        buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
        buildCommand "org.eclipse.jdt.core.javabuilder"
        buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
    }
}

// sets up the Android Idea project, using the old Ant based build.
idea {
    module {
        sourceDirs += file("src");
        scopes = [ COMPILE: [plus:[project.configurations.compile]]]        

        iml {
            withXml {
                def node = it.asNode()
                def builder = NodeBuilder.newInstance();
                builder.current = node;
                builder.component(name: "FacetManager") {
                    facet(type: "android", name: "Android") {
                        configuration {
                            option(name: "UPDATE_PROPERTY_FILES", value:"true")
                        }
                    }
                }
            }
        }
    }
}




这非常令人困惑,因为gradle文件的代码是在我为libgdx进行设置时自动生成的,因此我无法弄清楚它为什么会出错并且不包含依赖项部分。

1 个答案:

答案 0 :(得分:2)

 java.lang.NoClassDefFoundError: com.kilobolt.TweenAccessors.SpriteAccessor

您的应用无法找到任何返回TweenEngine的类,因此这是您的项目设置而不是代码的问题。

我之前从未使用过这个库,但快速的Google搜索显示了一些关于为Android添加依赖项的内容? https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine