java.lang.noclassdeffounderror with libgdx and Android studio on the androidLauncher - android

I imported a package of my own called server (the logic of my program) and was going to use libgdx for the graphics/cross platform. The desktop launcher works fine but when I run the android launcher I get this nasty error referring to my own library.
E/AndroidRuntime: FATAL EXCEPTION: GLThread 187
Process: com.mygdx.game, PID: 8093
java.lang.NoClassDefFoundError: server.Point
at server.Shape.<init>(Shape.java:9)
at server.T.<init>(T.java:7)
at server.Stack.<init>(Stack.java:28)
at server.Logic.<init>(Logic.java:14)
at com.mygdx.game.GameLoop.create(GameLoop.java:43)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:275)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1511)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
any help would be great

I solved it!
It was because I was using java.awt.point in the android build. So I basically wrote a new point class, replace it, and then cleaned my project. Everything works now

Related

How can I black-box a library in the android debugger

I'm using khttp to perform HTTP requests in my Android app, but every time I start adding breakpoints to my app in Android Studio 3.1, I'm getting this really annoying Illegal State Exception, at which point I them need to restart Android Studio. Here's an example of the exception thrown:
E/AndroidRuntime: FATAL EXCEPTION: Thread-4
Process: com.sbrl.peppermint, PID: 10777
java.lang.IllegalStateException: Cannot access request header fields after connection is set
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getRequestProperties(HttpURLConnectionImpl.java:232)
at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getRequestProperties(DelegatingHttpsURLConnection.java:182)
at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getRequestProperties(Unknown Source:0)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.getRequestProperties(TrackedHttpURLConnection.java:204)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.trackPreConnect(TrackedHttpURLConnection.java:63)
at com.android.tools.profiler.support.network.httpurl.TrackedHttpURLConnection.connect(TrackedHttpURLConnection.java:126)
at com.android.tools.profiler.support.network.httpurl.HttpsURLConnection$.connect(HttpsURLConnection$.java:366)
at khttp.responses.GenericResponse.openRedirectingConnection$khttp(GenericResponse.kt:125)
at khttp.responses.GenericResponse.getConnection(GenericResponse.kt:163)
at khttp.responses.GenericResponse.getRaw(GenericResponse.kt:207)
at khttp.responses.GenericResponse.getContent(GenericResponse.kt:216)
at khttp.responses.GenericResponse.init$khttp(GenericResponse.kt:377)
at khttp.KHttp.request(KHttp.kt:61)
at khttp.KHttp.request$default(KHttp.kt:59)
I know that this question explains why this is happening, but my question is this:
How can I black-box the khttp library (similar to the way that Chrome allows you to black-box a JS source file), such that the Android debugger does not inspect it - throwing this exception?

Cannot run Helloworld in cocos2d-x 3.11: Fatal Signal 11

I'm new to cocos2d-x, I followed this tutorial
It's working well on the iOS platform, but not on Android.
I tried to setup cocos2d-x again and again, both cocos2d-x 3.11, 3.8, 3.6; tried with Android NDK r11c, r10e, r9d; tried to run in terminal and Eclipse, but the program cannot run and gives an error Fatal Signal 11.
It's work well with cocos2d-x 2.2.6, but I don't want to use it.
I'm using Genymotion.
Can anyone show me where my error lies?
This is my logcat:
05-16 22:02:43.979: D/dalvikvm(2395): Trying to load lib /data/app-lib/com.sangle.mygametest11-2/libMyGame.so 0xa4f9ab10
05-16 22:02:44.339: A/libc(2395): Fatal signal 11 (SIGSEGV) at 0x000000b4 (code=1), thread 2395 (le.mygametest11)
Compile it through the console and if error occurs post it here.
Go to android folder inside your project through cmd run "build_setup.py".

My Hello World does run, but only shortly - Android

all I am doing:
Eclipse --> new Project --> Android Application --> Activity type: blank
no changes in the code, just the simple Hello world.
It does start, I see the Hello World on the virtual device, but then immediately shuts down.
The logcat is as follows:
08-31 06:01:14.976: W/dalvikvm(1114): threadid=1: thread exiting with uncaught exception(group=0xb2aeeba8)
08-31 06:01:14.996: E/AndroidRuntime(1114): FATAL EXCEPTION: main
08-31 06:01:14.996: E/AndroidRuntime(1114): Process: com.example.tester, PID: 1114
08-31 06:01:14.996: E/AndroidRuntime(1114): java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable
08-31 06:01:14.996: E/AndroidRuntime(1114): at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:107)
Any Ideas?
Edit:
Ok, apparently I for some reason have a dependency mixup:
Found 2 versions of android-support-v4.jar in the dependency list,
[2014-08-31 12:22:46 - tester] but not all the versions are identical (check is based on SHA-1 only at this
Can I simply delete one of them?
The error is essentially telling you that it can't find the Android Support Library, which it is using as a dependency.
Without knowing what build process you're using (e.g gradle) it's difficult to tell you how to fix it, but basically you'll need to either add it as a dependency, or remove the code that requires it.
For more information on the Android Support Library, try this:
https://developer.android.com/tools/support-library/index.html
If do not work the try this :
Step #1: Undo all that. If you are messing with the build path, on R16 or higher version of the ADT plugin for Eclipse, you're doing it wrong.
Step #2: Pick one of those two versions of the JAR, or pick the one from the "extras" area of your SDK installation.
Step #3: Put the right JAR in App Library.
Step #4: Delete the one from App Free, since it will pick up that JAR from App Library.

fatal error: Unable to instantiate application android.app.Application

I am working on a school project to create basic android apps. It runs very well before I added few classes (I copy-paste them from my previous classes, it has the same logic/structure but different XML)
When I tried to run my 'updated' app, logCat always show this error:
05-07 09:19:15.402: E/AndroidRuntime(1370): FATAL EXCEPTION: main
05-07 09:19:15.402: E/AndroidRuntime(1370): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.anatomi; is package not installed?
05-07 09:19:15.402: E/AndroidRuntime(1370): at android.app.LoadedApk.makeApplication(LoadedApk.java:509)
and then, on the emulator, the "unfortunately, application has stopped" message appears.
However after I pressed OK, it's not even crashing and the app runs as normal.
Am I missing something? I'm pretty sure that the .java and .xml have the right structure, and the manifest too.
This happens sometimes when pushing a new version of your app to the device or emulator, when the old version is swapped with the new version. During that time, the package is not available, and this 'crash' occurs.
This is nothing to worry about, as this scenario will not occur in 'real life' (assuming Play Store updates are handled more gracefully, as I've never seen these crashes there).

Cannot run libgdx's 'Animation3DTest' on Android

I am trying to run the Animation3DTest , one of libgdx's test examples
On the desktop (lwjgl) I can run this test flawlessly, I can see a guy and a sword and I can move him around without any errors.
However, on Android, after starting this test, I got a force stop, and here is what showed on the Logcat
09-24 10:46:49.526 24530-24577/com.badlogic.gdx.tests.android E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 1445
com.badlogic.gdx.utils.GdxRuntimeException: File not found: com/badlogic/gdx/graphics/g3d/shaders/default.vertex.glsl (Classpath)
at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:133)
at com.badlogic.gdx.backends.android.AndroidFileHandle.read(AndroidFileHandle.java:77)
at com.badlogic.gdx.files.FileHandle.length(FileHandle.java:563)
at com.badlogic.gdx.backends.android.AndroidFileHandle.length(AndroidFileHandle.java:162)
at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:192)
at com.badlogic.gdx.files.FileHandle.readString(FileHandle.java:186)
at com.badlogic.gdx.graphics.g3d.shaders.DefaultShader.getDefaultVertexShader(DefaultShader.java:249)
at com.badlogic.gdx.graphics.g3d.utils.DefaultShaderProvider.<init>(DefaultShaderProvider.java:44)
at com.badlogic.gdx.graphics.g3d.ModelBatch.<init>(ModelBatch.java:101)
at com.badlogic.gdx.tests.g3d.BaseG3dTest.create(BaseG3dTest.java:38)
at com.badlogic.gdx.tests.g3d.BaseG3dHudTest.create(BaseG3dHudTest.java:50)
at com.badlogic.gdx.tests.g3d.Animation3DTest.create(Animation3DTest.java:45)
at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:322)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1514)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1242)
Get the latest nightly build. Here's the bug report.

Categories

Resources