I'm trying to paint a ball on the screen, but it force closes. Something is going wrong.
Ball b = new Ball();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.ingame);
start();
}
private void start() {
Ball b = new Ball();
}
public void paint(Graphics g) {
b.paint(g);
g.setColor(Color.GREEN);
g.fillOval(x-radius, y-radius, radius*2, radius*2);
}
Here's my LogCat:
10-15 21:02:45.492: E/dalvikvm(7847): Could not find class 'com.game.src.Ball', referenced from method com.jordan.bungee.bounce.Cracka.
10-15 21:02:45.492: W/dalvikvm(7847): VFY: unable to resolve new-instance 417 (Lcom/game/src/Ball;) in Lcom/jordan/bungee/bounce/Cracka;
10-15 21:02:45.492: D/dalvikvm(7847): VFY: replacing opcode 0x22 at 0x002b
10-15 21:02:45.492: D/dalvikvm(7847): VFY: dead code 0x002d-0032 in Lcom/jordan/bungee/bounce/Cracka;. ()V
10-15 21:02:45.496: E/dalvikvm(7847): Could not find class 'com.game.src.Ball', referenced from method com.jordan.bungee.bounce.Cracka.start
10-15 21:02:45.496: W/dalvikvm(7847): VFY: unable to resolve new-instance 417 (Lcom/game/src/Ball;) in Lcom/jordan/bungee/bounce/Cracka;
10-15 21:02:45.496: D/dalvikvm(7847): VFY: replacing opcode 0x22 at 0x0000
10-15 21:02:45.500: D/dalvikvm(7847): VFY: dead code 0x0002-0005 in Lcom/jordan/bungee/bounce/Cracka;.start ()V
10-15 21:02:45.500: W/dalvikvm(7847): VFY: unable to find class referenced in signature (Ljava/awt/Graphics;)
10-15 21:02:45.503: I/dalvikvm(7847): Could not find method com.game.src.Ball.paint, referenced from method com.jordan.bungee.bounce.Cracka.paint
10-15 21:02:45.503: W/dalvikvm(7847): VFY: unable to resolve virtual method 3021: Lcom/game/src/Ball;.paint (Ljava/awt/Graphics;)V
10-15 21:02:45.503: D/dalvikvm(7847): VFY: replacing opcode 0x6e at 0x0002
10-15 21:02:45.503: D/dalvikvm(7847): VFY: dead code 0x0005-001f in Lcom/jordan/bungee/bounce/Cracka;.paint (Ljava/awt/Graphics;)V
10-15 21:02:45.507: D/AndroidRuntime(7847): Shutting down VM
10-15 21:02:45.507: W/dalvikvm(7847): threadid=1: thread exiting with uncaught exception (group=0x4001e578)
10-15 21:02:45.527: E/AndroidRuntime(7847): FATAL EXCEPTION: main
10-15 21:02:45.527: E/AndroidRuntime(7847): java.lang.NoClassDefFoundError: com.game.src.Ball
10-15 21:02:45.527: E/AndroidRuntime(7847): at com.jordan.bungee.bounce.Cracka.(Cracka.java:22)
10-15 21:02:45.527: E/AndroidRuntime(7847): at java.lang.Class.newInstanceImpl(Native Method)
10-15 21:02:45.527: E/AndroidRuntime(7847): at java.lang.Class.newInstance(Class.java:1409)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.os.Handler.dispatchMessage(Handler.java:99)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.os.Looper.loop(Looper.java:130)
10-15 21:02:45.527: E/AndroidRuntime(7847): at android.app.ActivityThread.main(ActivityThread.java:3687)
10-15 21:02:45.527: E/AndroidRuntime(7847): at java.lang.reflect.Method.invokeNative(Native Method)
10-15 21:02:45.527: E/AndroidRuntime(7847): at java.lang.reflect.Method.invoke(Method.java:507)
10-15 21:02:45.527: E/AndroidRuntime(7847): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
10-15 21:02:45.527: E/AndroidRuntime(7847): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
10-15 21:02:45.527: E/AndroidRuntime(7847): at dalvik.system.NativeStart.main(Native Method)
See Question&Answers more detail:
os