java - Can't figure out this NoClassDefFoundError - class should exist at runtime? -


as far i've been concerned, or seen in practice, error when referenced class can't found @ runtime. i'm pretty sure tap gets created initialization of menuscreen, might doing wrong. first attempt @ menu, or having multiple screens @ in libgdx.

this first section of menuscreen class, initialized in androidlauncher.java (initalize(new menuscreen(new tap()), config);)

public class menuscreen extends game implements screen {      ...      game g;     public menuscreen(game g) {         create();         this.g = g;     } 

and relevant pieces of tap.java

public class tap extends game implements actionlistener, screen {   ...   public tap() {     create(); } 

i can't seem figure out why won't work. missing obvious? i've tried few different things, part don't have enough understanding yet make real changes.

thanks.

edit: stack trace

12-15 22:42:35.614: e/androidruntime(16426): fatal exception: main 12-15 22:42:35.614: e/androidruntime(16426): java.lang.noclassdeffounderror: com.joelhunter.game.tap 12-15 22:42:35.614: e/androidruntime(16426):    @ com.joelhunter.game.android.androidlauncher.oncreate(androidlauncher.java:16) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.activity.performcreate(activity.java:5133) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1087) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.activitythread.performlaunchactivity(activitythread.java:2230) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.activitythread.handlelaunchactivity(activitythread.java:2316) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.activitythread.access$600(activitythread.java:150) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.activitythread$h.handlemessage(activitythread.java:1298) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.os.handler.dispatchmessage(handler.java:99) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.os.looper.loop(looper.java:213) 12-15 22:42:35.614: e/androidruntime(16426):    @ android.app.activitythread.main(activitythread.java:5225) 12-15 22:42:35.614: e/androidruntime(16426):    @ java.lang.reflect.method.invokenative(native method) 12-15 22:42:35.614: e/androidruntime(16426):    @ java.lang.reflect.method.invoke(method.java:525) 12-15 22:42:35.614: e/androidruntime(16426):    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:741) 12-15 22:42:35.614: e/androidruntime(16426):    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:557) 12-15 22:42:35.614: e/androidruntime(16426):    @ dalvik.system.nativestart.main(native method) 

you're misunderstanding how game , screens used.

you must have 1 game:

public class tap extends game{   ...   public tap() {     setscreen(new menuscreen(this)); } 

and several screens:

public class menuscreen implements screen {  ...  game g; public menuscreen(game g){     create();     this.g = g;      //if touch on "play" button:     g.setscreen(new gamescreen(this)); } 

for example gamescreen:

public class gamescreen implements screen {  ...  game g; public gamescreen(game g){     create();     this.g = g; } 

etc, etc.

also check core project added dependency android , desktop projects.

right click android/desktop -> java build path -> projects tab, , check if core project added. if isn't, add it.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -