Slick Forums

Discuss the Slick 2D Library
It is currently Sun Jul 21, 2019 8:27 am

All times are UTC




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Mon Jan 23, 2012 5:17 pm 
Offline

Joined: Mon Jan 23, 2012 2:45 pm
Posts: 4
I recently made my first game and recently finished it for PC. I'm now trying to port it to Android, but I'm stuck.

I followed the excellent intro to slick-ae, found here viewtopic.php?f=21&t=3496

However, I did not make my own slick-ae.jar, rather i used the patched version made by Mr. Kenkrok.

I got the emulator to run fine, but I cant get my program to work. I get an error message emulator: WARNING: Unable to create sensors port: Unknown error, however apparently this error is to be disregarded. When I check logcat my program cant find the class from my PC-project, even though I've linked to it in every way I could think of.

I really need help with this, I'll post the logcat here

01-23 18:06:04.438: D/dalvikvm(533): Not late-enabling CheckJNI (already on)
01-23 18:06:05.708: E/dalvikvm(533): Could not find class 'fuckaround.MainClass', referenced from method fuckaround.Android.FuckaroundAndroidActivity.onCreate
01-23 18:06:05.708: W/dalvikvm(533): VFY: unable to resolve new-instance 388 (Lfuckaround/MainClass;) in Lfuckaround/Android/FuckaroundAndroidActivity;
01-23 18:06:05.738: D/dalvikvm(533): VFY: replacing opcode 0x22 at 0x0003
01-23 18:06:05.748: D/dalvikvm(533): DexOpt: unable to opt direct call 0x1008 at 0x05 in Lfuckaround/Android/FuckaroundAndroidActivity;.onCreate
01-23 18:06:05.748: W/System.err(533): GdxNativesLoader: Couldn't unpack and load native 'libgdx.so'
01-23 18:06:05.748: D/dalvikvm(533): Trying to load lib /data/data/fuckaround.Android/lib/libgdx.so 0x412a5800
01-23 18:06:05.788: D/dalvikvm(533): Added shared lib /data/data/fuckaround.Android/lib/libgdx.so 0x412a5800
01-23 18:06:05.788: D/dalvikvm(533): No JNI_OnLoad found in /data/data/fuckaround.Android/lib/libgdx.so 0x412a5800, skipping init
01-23 18:06:05.818: E/SLICK(533): Slick-AE 0
01-23 18:06:06.049: D/dalvikvm(533): GC_CONCURRENT freed 79K, 2% free 9437K/9607K, paused 6ms+4ms
01-23 18:06:06.058: D/AndroidRuntime(533): Shutting down VM
01-23 18:06:06.058: W/dalvikvm(533): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
01-23 18:06:06.088: E/AndroidRuntime(533): FATAL EXCEPTION: main
01-23 18:06:06.088: E/AndroidRuntime(533): java.lang.NoClassDefFoundError: fuckaround.MainClass
01-23 18:06:06.088: E/AndroidRuntime(533): at fuckaround.Android.FuckaroundAndroidActivity.onCreate(FuckaroundAndroidActivity.java:20)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.Activity.performCreate(Activity.java:4465)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.ActivityThread.access$600(ActivityThread.java:123)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.os.Handler.dispatchMessage(Handler.java:99)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.os.Looper.loop(Looper.java:137)
01-23 18:06:06.088: E/AndroidRuntime(533): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-23 18:06:06.088: E/AndroidRuntime(533): at java.lang.reflect.Method.invokeNative(Native Method)
01-23 18:06:06.088: E/AndroidRuntime(533): at java.lang.reflect.Method.invoke(Method.java:511)
01-23 18:06:06.088: E/AndroidRuntime(533): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-23 18:06:06.088: E/AndroidRuntime(533): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-23 18:06:06.088: E/AndroidRuntime(533): at dalvik.system.NativeStart.main(Native Method)

I'd be very grateful for any possible help!


Top
 Profile  
 
PostPosted: Tue Jan 24, 2012 4:56 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Hey WhiteFenix,
you're right about the ignored warnings and exceptions, I see a lot of those each time I run a project. It looks like the important message here is:

01-23 18:06:06.088: E/AndroidRuntime(533): java.lang.NoClassDefFoundError: fuckaround.MainClass
01-23 18:06:06.088: E/AndroidRuntime(533): at fuckaround.Android.FuckaroundAndroidActivity.onCreate(FuckaroundAndroidActivity.java:20)

It appears that the android project cannot find your main class. Make sure that you have your standard project on the build path of your android project (in eclipse right-click-android-project>build path>configure build path>projects tab>add your project, or something like that). If you do, then post your android activity. The problem might be in fuckaround.Android.FuckaroundAndroidActivity.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Wed Jan 25, 2012 8:51 pm 
Offline

Joined: Mon Jan 23, 2012 2:45 pm
Posts: 4
Alright, I will continue to disregard that message then. I did have the project on the build path as you suggested, my activity class looks like this;

package fuckaround.Android;

import android.os.Bundle;
import org.newdawn.slick.SlickActivity;
import fuckaround.MainClass;

public class FuckaroundAndroidActivity extends SlickActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
start(new MainClass(), 850, 480);
}
}

I might have made some mistake with the imports, but I don't know what it is.

Edit: To clarify, :20 is super.onCreate(savedInstanceState); in case you needed to know


Top
 Profile  
 
PostPosted: Thu Jan 26, 2012 6:19 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Your Android application looks right, so it looks like something in the build path is wrong. Perhaps the project is not building properly. If you use Eclipse, clean the projects (I think it's workspace>clean) and see if the build path issue is resolved. If it isn't then you might test whether the build path is messing you up in some way. The best way I can think to test whether the build path is setup wrong is to temporarily put everything into the android project. Try copying all of your desktop project source into the android project source and removing your project from the build path. If it still doesn't work, then it's not the build path, and there must be another problem that is keeping the project form finding the right classes.

I've written a lot, but of course, I don't know your project as well as you do. If you come up with some other possible problem, or another way of debugging it, I would try that first.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Fri Jan 27, 2012 10:15 pm 
Offline

Joined: Mon Jan 23, 2012 2:45 pm
Posts: 4
I tried the cleaning first, but that didnt do squat, so I tried to copy the source to the android source, but I ran into trouble. At first it didn't notice the classes at all, so I put them in a seperate folder in the src folder, but the project automatically excluded the folder from the build path, when I tried to include it I got the following message "Cannot nest 'FuckaroundAndroid/s...p/' from 'FuckaroundAndroid/src'". To me it seems that the android project refuses to the classes from the desktop project, is there something I'm missing, or simply neglecting to do?


Top
 Profile  
 
PostPosted: Sun Jan 29, 2012 1:30 am 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
This is a weird one. Can you post a picture of your workspace? perhps there is something out of place there.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 7:16 pm 
Offline

Joined: Mon Jan 23, 2012 2:45 pm
Posts: 4
Sure thing. I tried a few different variations when it didnt work.

Heres one where all the class files are in the same folder as the original Activity

http://imgur.com/Zndzl

Heres a different one where i put all the class files in a seperate folder and put in the source folder

http://imgur.com/edhXv

Which then gets automatically excluded from the source tab of the build path. If I include it, I get the following error message;

Cannot nest 'FuckaroundAndroid/s...p/' from 'FuckaroundAndroid/src'


Top
 Profile  
 
PostPosted: Mon Jan 30, 2012 9:28 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
I'm going to have to try to recreate this when I get access to a computer I can program on (i've been roughing it, using university computers and a USB drive I lost last wednesday). However, I have begun to worry that I might actually have seen this bug before. I had a problem where the android project would not find certain classes on the build path, and no matter what I did, I couldn't get them on. I never solved this bug. I ended up restarting the project in a new workspace. I decided to copy my files into the workspace incrementally, and see when I started getting the bug again, but once I moved to a new project, i stopped getting the bug. It was weird. Really weird. Try making a new android project and slowly making it like your original, should-be-working-but-isn't project. See if you can add things incrementally and pinpoint exactly when the program crashes. Maybe it will be like Gearbie, and won't crash again. I just don't know, and it irritates me.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group