0

I wanted to use a 'switch' with String, which is supported only in compiler level 1.7, so Eclipse offered me to upgrade it, and then fix my project properties. Since then, my app starts, and even before OnCreate is called, it crashes. I know for sure that the problem is the compiler level, but I reverted it back to defaults, and still it doesn't work... What can I do?

Thanks!

Stacktrace:

06-25 17:39:09.039: D/AndroidRuntime(265): Shutting down VM
06-25 17:39:09.049: W/dalvikvm(265): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
06-25 17:39:09.080: E/AndroidRuntime(265): FATAL EXCEPTION: main
06-25 17:39:09.080: E/AndroidRuntime(265): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.ronEven.iCards/com.ronEven.iCards.Main}: java.lang.ClassNotFoundException: com.ronEven.iCards.Main in loader dalvik.system.PathClassLoader[/data/app/com.ronEven.iCards-1.apk]
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.os.Handler.dispatchMessage(Handler.java:99)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.os.Looper.loop(Looper.java:123)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.ActivityThread.main(ActivityThread.java:4627)
06-25 17:39:09.080: E/AndroidRuntime(265):  at java.lang.reflect.Method.invokeNative(Native Method)
06-25 17:39:09.080: E/AndroidRuntime(265):  at java.lang.reflect.Method.invoke(Method.java:521)
06-25 17:39:09.080: E/AndroidRuntime(265):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-25 17:39:09.080: E/AndroidRuntime(265):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-25 17:39:09.080: E/AndroidRuntime(265):  at dalvik.system.NativeStart.main(Native Method)
06-25 17:39:09.080: E/AndroidRuntime(265): Caused by: java.lang.ClassNotFoundException: com.ronEven.iCards.Main in loader dalvik.system.PathClassLoader[/data/app/com.ronEven.iCards-1.apk]
06-25 17:39:09.080: E/AndroidRuntime(265):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
06-25 17:39:09.080: E/AndroidRuntime(265):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
06-25 17:39:09.080: E/AndroidRuntime(265):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
06-25 17:39:09.080: E/AndroidRuntime(265):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
06-25 17:39:09.080: E/AndroidRuntime(265):  ... 11 more
user207421
  • 305,947
  • 44
  • 307
  • 483
RE6
  • 2,684
  • 4
  • 31
  • 57
  • Sorry for nooby question, but how? – RE6 Jun 25 '12 at 17:34
  • In this case, it's probably your LogCat. There should be a window below your coding perspective that says "LogCat". Select as many entries as you feel are necessary, copy-paste them, and then format them as a codeblock. – Jason L Jun 25 '12 at 17:35
  • Oh... For some reason it doesn't contain any data... (ROM issues) I will run an emulator and post it... – RE6 Jun 25 '12 at 17:36
  • I added stacktrace in the main post – RE6 Jun 25 '12 at 17:43

2 Answers2

3

You can only use Java 1.6 with Android. Switch statements in 1.6 do not support strings, while annoying, it's just the way it is.

As for 'reverting back' you could go through the steps of fixing the project but it would just be easier to create a new project and start fresh. When you get more comfortable with Eclipse, my guess is your build path settings are ajar and that is your hangup. Lint might be able to point out the problem to you but that seems to be a coin toss with Lint.

ian.shaun.thomas
  • 3,468
  • 25
  • 40
  • Obviously I can start fresh, but I don't want to... it is a very massive project that I don't want to reorganize... – RE6 Jun 25 '12 at 17:46
  • Then you should create a new android project and then check the build path settings. 99% chance all your issues are in the build path. – ian.shaun.thomas Jun 25 '12 at 19:38
1

See this: Java 7 language features with Android

Basically, Java 1.7 can't really be used with Android. You can use the 1.7 JDK, however you will be forced to use 1.6.

Simply put, stick to 1.6.

Community
  • 1
  • 1
Alex Fu
  • 5,509
  • 3
  • 31
  • 40