Author Topic: Getting Hello World to work  (Read 2555 times)

Offline mccluredanr

  • byte
  • *
  • Posts: 1
    • View Profile
Getting Hello World to work
« on: September 23, 2012, 01:22:48 am »
Hey so I created an Android app on Eclipse, then I copied the files that came in examples/helloworld-ae into my project directory. I replaced all files in my empty project directory with those files. My goal was to just get a working app that I could edit and play around with. It builds with no errors but when it runs it simply shows "Unfortunately Helloworld has stopped" on my AVD. I have made sure to include the jpct-ae jar in the library and plugin build path. Any thoughts on what I could have done wrong would help me greatly.

Dan

Edit: I thought this might help. Its the logcat of when the app starts to run. I've read through it, but I don't really know what most of the stuff means. I'm going to keep googleing them but I would still like any tips.


Code: [Select]
09-22 16:29:35.315: E/Trace(639): error opening trace file: No such file or directory (2)
09-22 16:29:35.636: D/AndroidRuntime(639): Shutting down VM
09-22 16:29:35.686: W/dalvikvm(639): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
09-22 16:29:35.696: E/AndroidRuntime(639): FATAL EXCEPTION: main
09-22 16:29:35.696: E/AndroidRuntime(639): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.threed.jpct.example/com.threed.jpct.example.HelloWorld}: java.lang.ClassNotFoundException: com.threed.jpct.example.HelloWorld
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.os.Handler.dispatchMessage(Handler.java:99)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.os.Looper.loop(Looper.java:137)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-22 16:29:35.696: E/AndroidRuntime(639): at java.lang.reflect.Method.invokeNative(Native Method)
09-22 16:29:35.696: E/AndroidRuntime(639): at java.lang.reflect.Method.invoke(Method.java:511)
09-22 16:29:35.696: E/AndroidRuntime(639): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-22 16:29:35.696: E/AndroidRuntime(639): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-22 16:29:35.696: E/AndroidRuntime(639): at dalvik.system.NativeStart.main(Native Method)
09-22 16:29:35.696: E/AndroidRuntime(639): Caused by: java.lang.ClassNotFoundException: com.threed.jpct.example.HelloWorld
09-22 16:29:35.696: E/AndroidRuntime(639): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
09-22 16:29:35.696: E/AndroidRuntime(639): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
09-22 16:29:35.696: E/AndroidRuntime(639): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
09-22 16:29:35.696: E/AndroidRuntime(639): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
09-22 16:29:35.696: E/AndroidRuntime(639): ... 11 more
09-22 16:29:41.225: I/Process(639): Sending signal. PID: 639 SIG: 9
« Last Edit: September 23, 2012, 01:34:36 am by mccluredanr »

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Getting Hello World to work
« Reply #1 on: September 23, 2012, 02:36:37 pm »
Looks like a class reference is incorrect:
Unable to instantiate activity ComponentInfo {com.threed.jpct.example/com.threed.jpct.example.HelloWorld}

Have a look in your AndroidManifest.xml file for the problem or show us the contents of the xml file.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Getting Hello World to work
« Reply #2 on: September 23, 2012, 03:39:12 pm »
Check if you have checked "Java build path" -> "Order and export" tab -> jpct_ae.jar in your project

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Getting Hello World to work
« Reply #3 on: September 23, 2012, 04:09:34 pm »
Yeah as mentioned also make sure you copy the jPCT lib file into the lib folder in the base path of your folder and set the build path selecting "Add Jars" within the project properties.

If you get a jpct classnotfound error/crash in the logs during runtime, change the lib folder to 'libs' using the refractor in eclipse's context menu after right-clicking the lib folder.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Getting Hello World to work
« Reply #4 on: September 23, 2012, 04:18:49 pm »
Yeah as mentioned also make sure you copy the jPCT lib file into the lib folder in the base path of your folder and set the build path selecting "Add Jars" within the project properties.

If you get a jpct classnotfound error/crash in the logs during runtime, change the lib folder to 'libs' using the refractor in eclipse's context menu after right-clicking the lib folder.

This is unnecessary in new versions ;)

Offline K24A3

  • long
  • ***
  • Posts: 231
    • View Profile
Re: Getting Hello World to work
« Reply #5 on: September 23, 2012, 04:58:37 pm »
This is unnecessary in new versions ;)

Not sure about that because I updated to the latest version today (v20) and suddenly ran into this problem. All my projects now give runtime errors unless I rename lib to libs then update the build path to jPCT.