libgdx - android issue - "Unfortunately [app name] has stopped"

1.8k views Asked by At

Sorry if I'm doing something very dumb or if this is a stupid question, but as you can probably tell I'm new to programming so any help would be greatly appreciated!

I can get my libgdx game running on my desktop just fine, however when I try to run it on my android phone or on genymotion, I get a popup that says "Unfortunately, [app name] has stopped".

Here's the errors in the LogCat (very long unfortunately) :

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!

As you can see in my logcat, it says the "fatal exception" is at GLThread 96, but I'm not sure how thats relevant.

The code for configuration is

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);
 }
}

The code of 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();
    }
}

This is very perplexing because the game works exactly how it should when running it on desktop. I'm also using Tween and it was involved with some errors in the logcat, but after looking through my code I don't think Tween is the reason its not working because my Tween code looks perfect and is error free.

If there is an important piece of information I'm leaving out just let me know and I will post it, I have been trying to solve this problem for three days and I am desperate to fix it. Thank you for your help.

EDIT: It appears the issue is with the setup of my program The problem seems to be with my gradle, it is different then it is supposed to be. On https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine it states to " Locate the section marked project(":core") In the dependencies section add the following line: compile fileTree(dir: '../libs', include: '*.jar')"

HOWEVER no such section in my gradle exists. Here is the code for my gradle file

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")
                        }
                    }
                }
            }
        }
    }
}

This is extremely confusing because the code for the gradle file was automatically generated when I did the setup for libgdx so I can't figure out why it would be wrong and not contain a dependencies section.

1

There are 1 answers

2
Edward van Raak On
 java.lang.NoClassDefFoundError: com.kilobolt.TweenAccessors.SpriteAccessor

Your app is unable to find any classes leading back to TweenEngine so this is a problem with your project setup rather than your code.

I have never used this library before but a quick Google Search revealed something about adding dependencies for Android? https://github.com/libgdx/libgdx/wiki/Universal-Tween-Engine