Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMatt Motamedi
6,709 PointsCrystalBall stopped working
So I saw there was like 100 threads on this but I havent managed to find an answer to this issue somehow. At first I was getting an error trying to add the 'final' tag after you do the quickfix which i got to work but now when I run the app it just crashes. Here is what my LogCat says (i see the fatal exception there but cant pinpoint what is causing that or why its happening:
07-11 22:14:07.269: D/AndroidRuntime(1132): Shutting down VM 07-11 22:14:07.269: W/dalvikvm(1132): threadid=1: thread exiting with uncaught exception (group=0xb1adcba8) 07-11 22:14:07.309: E/AndroidRuntime(1132): FATAL EXCEPTION: main 07-11 22:14:07.309: E/AndroidRuntime(1132): Process: matt.crystalball, PID: 1132 07-11 22:14:07.309: E/AndroidRuntime(1132): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{matt.crystalball/matt.crystalball.MainActivity}: java.lang.NullPointerException 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.ActivityThread.access$800(ActivityThread.java:135) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.os.Handler.dispatchMessage(Handler.java:102) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.os.Looper.loop(Looper.java:136) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.ActivityThread.main(ActivityThread.java:5017) 07-11 22:14:07.309: E/AndroidRuntime(1132): at java.lang.reflect.Method.invokeNative(Native Method) 07-11 22:14:07.309: E/AndroidRuntime(1132): at java.lang.reflect.Method.invoke(Method.java:515) 07-11 22:14:07.309: E/AndroidRuntime(1132): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 07-11 22:14:07.309: E/AndroidRuntime(1132): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 07-11 22:14:07.309: E/AndroidRuntime(1132): at dalvik.system.NativeStart.main(Native Method) 07-11 22:14:07.309: E/AndroidRuntime(1132): Caused by: java.lang.NullPointerException 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.Activity.findViewById(Activity.java:1884) 07-11 22:14:07.309: E/AndroidRuntime(1132): at matt.crystalball.MainActivity.<init>(MainActivity.java:22) 07-11 22:14:07.309: E/AndroidRuntime(1132): at java.lang.Class.newInstanceImpl(Native Method) 07-11 22:14:07.309: E/AndroidRuntime(1132): at java.lang.Class.newInstance(Class.java:1208) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.Instrumentation.newActivity(Instrumentation.java:1061) 07-11 22:14:07.309: E/AndroidRuntime(1132): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112) 07-11 22:14:07.309: E/AndroidRuntime(1132): ... 11 more 07-11 22:14:11.609: I/Process(1132): Sending signal. PID: 1132 SIG: 9
Anything helps, thanks!
1 Answer
Dominik Schubert
1,724 PointsPlease show your code. Whats on your line 22? Did you compare your code with the example code?
Matt Motamedi
6,709 PointsMatt Motamedi
6,709 PointsSorry I forgot to mention I figured it out, i just restarted most of the project and it worked out fine, I must have missed something small along the way! thanks for responding