I have looked at the following which I thought would work but it did not.
Could not find class XXX referenced from method XXX.
Hello world, libgdx crashes on phone
Android Libgx Frogger game crashing: Could not find class 'com.rengelbert.froggergdx.FroggerGame'
My main diffrence between all the other questions is that I did not create the android project when I created the desktop project which I create with the Gdx-setup.jar. I decided to make an android project quite a bit after I created the desktop version.
I am getting the error:
08-23 05:30:09.341: E/dalvikvm(27497): Could not find class 'com.cvgstudios.pokemonchrome.ChromeGame', referenced from method com.cvgstudios.pokemonchrome.RunAndroidChrome.onCreate
08-23 05:30:09.341: W/dalvikvm(27497): VFY: unable to resolve new-instance 1027 (Lcom/cvgstudios/pokemonchrome/ChromeGame;) in Lcom/cvgstudios/pokemonchrome/RunAndroidChrome;
08-23 05:30:09.341: D/dalvikvm(27497): VFY: replacing opcode 0x22 at 0x0014
08-23 05:30:09.341: D/dalvikvm(27497): DexOpt: unable to opt direct call 0x2a07 at 0x16 in Lcom/cvgstudios/pokemonchrome/RunAndroidChrome;.onCreate
08-23 05:30:09.341: D/dalvikvm(27497): Trying to load lib /data/app-lib/com.cvgstudios.pokemonchrome-1/libgdx.so 0x41a79df0
08-23 05:30:09.349: D/dalvikvm(27497): Added shared lib /data/app-lib/com.cvgstudios.pokemonchrome-1/libgdx.so 0x41a79df0
08-23 05:30:09.349: D/dalvikvm(27497): No JNI_OnLoad found in /data/app-lib/com.cvgstudios.pokemonchrome-1/libgdx.so 0x41a79df0, skipping init
08-23 05:30:09.357: D/AndroidRuntime(27497): Shutting down VM
08-23 05:30:09.357: W/dalvikvm(27497): threadid=1: thread exiting with uncaught exception (group=0x41809700)
08-23 05:30:09.364: E/AndroidRuntime(27497): FATAL EXCEPTION: main
08-23 05:30:09.364: E/AndroidRuntime(27497): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cvgstudios.pokemonchrome/com.cvgstudios.pokemonchrome.RunAndroidChrome}: java.lang.NullPointerException
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2389)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.ActivityThread.access$600(ActivityThread.java:153)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1269)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.os.Looper.loop(Looper.java:137)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.ActivityThread.main(ActivityThread.java:5289)
08-23 05:30:09.364: E/AndroidRuntime(27497): at java.lang.reflect.Method.invokeNative(Native Method)
08-23 05:30:09.364: E/AndroidRuntime(27497): at java.lang.reflect.Method.invoke(Method.java:525)
08-23 05:30:09.364: E/AndroidRuntime(27497): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
08-23 05:30:09.364: E/AndroidRuntime(27497): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
08-23 05:30:09.364: E/AndroidRuntime(27497): at dalvik.system.NativeStart.main(Native Method)
08-23 05:30:09.364: E/AndroidRuntime(27497): Caused by: java.lang.NullPointerException
08-23 05:30:09.364: E/AndroidRuntime(27497): at com.cvgstudios.pokemonchrome.RunAndroidChrome.onCreate(RunAndroidChrome.java:17)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.Activity.performCreate(Activity.java:5133)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-23 05:30:09.364: E/AndroidRuntime(27497): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2293)
08-23 05:30:09.364: E/AndroidRuntime(27497): ... 11 more
As you can see the error is that
Could not find class 'com.cvgstudios.pokemonchrome.ChromeGame', referenced from method com.cvgstudios.pokemonchrome.RunAndroidChrome.onCreate
While looking around to find the answer to my dilema a possible solution was to make sure it was exporting the main project properly. I fixed that:
However the problem still persists.
I've checked everything all of the order and export boxes, in desktop, main and android project's buildpaths.
This is my class
import android.os.Bundle;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
public class RunAndroidChrome extends AndroidApplication {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.useGL20 = true;
Gdx.app.log(ChromeGame.LOG,
"Attempting to make Android Chrome Work");
initialize(new com.cvgstudios.pokemonchrome.ChromeGame(), cfg);
}
}