I am creating multiple activities in Android, this is my logcat error output.
log.txt
05-03 03:17:23.295: E/PhonePolicy(1854): Could not preload class for phone policy: com.android.internal.policy.impl.PhoneWindow$ContextMenuCallback
05-03 03:17:37.044: W/dalvikvm(1854): threadid=1: thread exiting with uncaught exception (group=0x409db1f8)
05-03 03:17:37.044: E/AndroidRuntime(1854): FATAL EXCEPTION: main
05-03 03:17:37.044: E/AndroidRuntime(1854): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jumoun.itemp/com.jumoun.itemp.Converter}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.os.Looper.loop(Looper.java:137)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.ActivityThread.main(ActivityThread.java:4427)
05-03 03:17:37.044: E/AndroidRuntime(1854): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 03:17:37.044: E/AndroidRuntime(1854): at java.lang.reflect.Method.invoke(Method.java:511)
05-03 03:17:37.044: E/AndroidRuntime(1854): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
05-03 03:17:37.044: E/AndroidRuntime(1854): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
05-03 03:17:37.044: E/AndroidRuntime(1854): at dalvik.system.NativeStart.main(Native Method)
05-03 03:17:37.044: E/AndroidRuntime(1854): Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
05-03 03:17:37.044: E/AndroidRuntime(1854): at com.jumoun.itemp.Converter.onCreate(Converter.java:41)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.Activity.performCreate(Activity.java:4465)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-03 03:17:37.044: E/AndroidRuntime(1854): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-03 03:17:37.044: E/AndroidRuntime(1854): ... 11 more
05-03 03:17:38.704: I/Process(1854): Sending signal. PID: 1854 SIG: 9
This is my java file Converter.java
http://pastebin.com/VNNPy7D5
Thanks guys :)
If I counted right this
ibHome3 = (Button) findViewById(R.id.ibHome3);
is causing your problem. You have it as an ImageButton in your xml but Button in your java declaration. Just change it to
ImageButton ibHome3;
About Logcat
Also, just a little advice on logcat. If you find the first line that says Caused By after Fatal Exception you can track down your problem easier. Here it is
Caused by: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button
this gives the exception
java.lang.ClassCastException
then find the first line after that which references your package. Here
at com.jumoun.itemp.Converter.onCreate(Converter.java:41)
this tells us the problem starts in Converter.java at line 41
You have two buttons in your layout file, right? They looks to be defined as ImageButton in the XML file. In your Activity, you declare it as Button and try to convert with a cast to (Button). Change your type to ImageButton on your Activity file. It may solve your prolbem.
On line 41, you have to cast your button to ImageButton and not Button :
ibHome3 = (ImageButton) findViewById(R.id.ibHome3);
Related
We tried integrating HelpStack by following steps given on GitHub, but we kept getting the following errors:
04-03 13:54:22.054 4638-4638/com.playerline.android E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.playerline.android/com.tenmiles.helpstack.activities.HomeActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4448)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.tenmiles.helpstack.activities.HSActivityParent.onCreate(HSActivityParent.java:48)
at com.tenmiles.helpstack.activities.HomeActivity.onCreate(HomeActivity.java:46)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4448)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
I'm guessing it has something to do with the App Theme, which in our case is is Theme.AppCompat.NoActionBar.
I have installed android sdk from this link http://developer.android.com/sdk/index.html.(installer_r18-windows.... android app is working fine.but my phonegap app is not running.same phonegap app is working in installer_r12-windows.exe
Error Message
05-03 19:55:36.310: E/AndroidRuntime(743): FATAL EXCEPTION: main
05-03 19:55:36.310: E/AndroidRuntime(743): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.mobilyzer/com.app.mobilyzer.MobilyzerActivity}: java.lang.ClassNotFoundException: com.app.mobilyzer.MobilyzerActivity
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.os.Looper.loop(Looper.java:137)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-03 19:55:36.310: E/AndroidRuntime(743): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 19:55:36.310: E/AndroidRuntime(743): at java.lang.reflect.Method.invoke(Method.java:511)
05-03 19:55:36.310: E/AndroidRuntime(743): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-03 19:55:36.310: E/AndroidRuntime(743): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-03 19:55:36.310: E/AndroidRuntime(743): at dalvik.system.NativeStart.main(Native Method)
05-03 19:55:36.310: E/AndroidRuntime(743): Caused by: java.lang.ClassNotFoundException: com.app.mobilyzer.MobilyzerActivity
05-03 19:55:36.310: E/AndroidRuntime(743): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-03 19:55:36.310: E/AndroidRuntime(743): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-03 19:55:36.310: E/AndroidRuntime(743): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-03 19:55:36.310: E/AndroidRuntime(743): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
05-03 19:55:36.310: E/AndroidRuntime(743): ... 11 more
You have placed you Jar file in some random folder and then did "Add to build path". This will work in versions older than r17. But now you have to create a folder named libs in your project folder and then just add the phonegap jar file in it and automatically it will be added to class path. And you will not get this issue.
Declare the activity in the Android Manifest? Make sure the launcher activity has the right name? Both possible solutions :D
I am using greenDao to access database in my Android phone. Everything seems fine, and complied. But when I run the program, it crashed at DaoMaster.java -> OpenHelper class, onCreate method at createAllTables(db, false);
Below are the Exception message:
>05-03 15:40:34.109: E/AndroidRuntime(28587): FATAL EXCEPTION: main
05-03 15:40:34.109: E/AndroidRuntime(28587): java.lang.NoClassDefFoundError: com.hook38.sporttimer.model.sql.DaoMaster
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.model.sql.DaoMaster$OpenHelper.onCreate(DaoMaster.java:42)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:165)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.controller.CountdownTimerStoreController.<init>(CountdownTimerStoreController.java:32)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.controller.CountdownTimerController.<init>(CountdownTimerController.java:57)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.hook38.sporttimer.CountDownTimerActivity.onCreate(CountDownTimerActivity.java:49)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.Activity.performCreate(Activity.java:4465)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.os.Handler.dispatchMessage(Handler.java:99)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.os.Looper.loop(Looper.java:137)
05-03 15:40:34.109: E/AndroidRuntime(28587): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-03 15:40:34.109: E/AndroidRuntime(28587): at java.lang.reflect.Method.invokeNative(Native Method)
05-03 15:40:34.109: E/AndroidRuntime(28587): at java.lang.reflect.Method.invoke(Method.java:511)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-03 15:40:34.109: E/AndroidRuntime(28587): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-03 15:40:34.109: E/AndroidRuntime(28587): at dalvik.system.NativeStart.main(Native Method)
I did some research on NoClassDefFoundError, and it means CLASSPATH was not set properly. but I checked the build path, greenDao.jar is in the library. Is there something I miss out??
I solved the problem. I was using the greenDao.jar file from the DaoExample project. The way to solve this is... remove the original greenDao.jar from my java build path. Make a folder call libs under my project. copy the geenDao.jar file from the libs folder in DaoExample project, and paste it into the libs file in my own project. Go to Java build path, libraries, import jar, and add the newly pasted jar file. wala~
The solution is ultra simple - Ensure Maven Dependencies are exported:
Project Properties -> Java Build Path -> Order and Export -> Tick Maven Dependencies
Clean Project
15 reports
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oas.fruitkungfufree/com.openfeint.internal.ui.IntroFlow}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.openfeint.internal.Util.setOrientation(Util.java:36)
at com.openfeint.internal.ui.NestedWindow.onCreate(NestedWindow.java:32)
at com.openfeint.internal.ui.WebNav.onCreate(WebNav.java:93)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
Does any one have a solution for this??
This is a problem with your code, you can't use an object that is null. This is a hint.
I have no Idea why I get this error :/
Exception class java.lang.NullPointerException
Source method Jax$7.onClick()
java.lang.NullPointerException
at com.reg.lolsoundboard.Jax$7.onClick(Jax.java:83)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9089)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Obviously you are dereferencing a variable in line 83 of the file Jax.java where the variable is null.
java.lang.NullPointerException
at com.reg.lolsoundboard.Jax$7.onClick(Jax.java:83)
If show the relevant code, people may be able to help you.