I have created a app based on the android tutorial : http://developer.android.com/training/basics/firstapp/index.html
The code is exactly the same except the app name but the application is force closing.
06-24 16:19:22.279: E/Zygote(33): setreuid() failed. errno: 2
06-24 16:19:33.028: E/Zygote(33): setreuid() failed. errno: 17
06-24 16:19:34.568: E/BatteryService(62): usbOnlinePath not found
06-24 16:19:34.568: E/BatteryService(62): batteryVoltagePath not found
06-24 16:19:34.568: E/BatteryService(62): batteryTemperaturePath not found
06-24 16:19:34.588: E/SurfaceFlinger(62): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
06-24 16:19:34.698: E/SensorService(62): couldn't open device for module sensors (Invalid argument)
06-24 16:19:39.449: E/System(62): Failure starting core service
06-24 16:19:39.449: E/System(62): java.lang.SecurityException
06-24 16:19:39.449: E/System(62): at android.os.BinderProxy.transact(Native Method)
06-24 16:19:39.449: E/System(62): at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
06-24 16:19:39.449: E/System(62): at android.os.ServiceManager.addService(ServiceManager.java:72)
06-24 16:19:39.449: E/System(62): at com.android.server.ServerThread.run(SystemServer.java:206)
06-24 16:19:39.479: E/EventHub(62): could not get driver version for /dev/input/mouse0, Not a typewriter
06-24 16:19:39.479: E/EventHub(62): could not get driver version for /dev/input/mice, Not a typewriter
06-24 16:19:39.808: E/SoundPool(62): error loading /system/media/audio/ui/Effect_Tick.ogg
06-24 16:19:39.808: E/SoundPool(62): error loading /system/media/audio/ui/KeypressStandard.ogg
06-24 16:19:39.808: E/SoundPool(62): error loading /system/media/audio/ui/KeypressSpacebar.ogg
06-24 16:19:39.808: E/SoundPool(62): error loading /system/media/audio/ui/KeypressDelete.ogg
06-24 16:19:39.808: E/SoundPool(62): error loading /system/media/audio/ui/KeypressReturn.ogg
06-24 16:19:39.828: E/UsbObserver(62): java.lang.NullPointerException
06-24 16:19:39.828: E/UsbObserver(62): at com.android.server.UsbObserver.init(UsbObserver.java:131)
06-24 16:19:39.828: E/UsbObserver(62): at com.android.server.UsbObserver.<init>(UsbObserver.java:65)
06-24 16:19:39.828: E/UsbObserver(62): at com.android.server.ServerThread.run(SystemServer.java:402)
06-24 16:19:40.429: E/ThrottleService(62): Could not open GPS configuration file /etc/gps.conf
06-24 16:19:40.958: E/logwrapper(137): executing /system/bin/tc failed: No such file or directory
06-24 16:19:41.069: E/logwrapper(139): executing /system/bin/tc failed: No such file or directory
06-24 16:19:41.129: E/logwrapper(144): executing /system/bin/tc failed: No such file or directory
06-24 16:37:58.420: E/AndroidRuntime(345): FATAL EXCEPTION: main
06-24 16:37:58.420: E/AndroidRuntime(345): java.lang.IllegalStateException: Could not execute method of the activity
06-24 16:37:58.420: E/AndroidRuntime(345): at android.view.View$1.onClick(View.java:2144)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.view.View.performClick(View.java:2485)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.view.View$PerformClick.run(View.java:9080)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.os.Handler.handleCallback(Handler.java:587)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.os.Handler.dispatchMessage(Handler.java:92)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.os.Looper.loop(Looper.java:123)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 16:37:58.420: E/AndroidRuntime(345): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:37:58.420: E/AndroidRuntime(345): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:37:58.420: E/AndroidRuntime(345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 16:37:58.420: E/AndroidRuntime(345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 16:37:58.420: E/AndroidRuntime(345): at dalvik.system.NativeStart.main(Native Method)
06-24 16:37:58.420: E/AndroidRuntime(345): Caused by: java.lang.reflect.InvocationTargetException
06-24 16:37:58.420: E/AndroidRuntime(345): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:37:58.420: E/AndroidRuntime(345): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.view.View$1.onClick(View.java:2139)
06-24 16:37:58.420: E/AndroidRuntime(345): ... 11 more
06-24 16:37:58.420: E/AndroidRuntime(345): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
06-24 16:37:58.420: E/AndroidRuntime(345): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.app.Activity.startActivityForResult(Activity.java:2827)
06-24 16:37:58.420: E/AndroidRuntime(345): at android.app.Activity.startActivity(Activity.java:2933)
06-24 16:37:58.420: E/AndroidRuntime(345): at com.myfirstapp.MyFirstActivity.sendMessage(MyFirstActivity.java:26)
06-24 16:37:58.420: E/AndroidRuntime(345): ... 14 more
06-24 16:38:47.529: E/AndroidRuntime(357): FATAL EXCEPTION: main
06-24 16:38:47.529: E/AndroidRuntime(357): java.lang.IllegalStateException: Could not execute method of the activity
06-24 16:38:47.529: E/AndroidRuntime(357): at android.view.View$1.onClick(View.java:2144)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.view.View.performClick(View.java:2485)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.view.View$PerformClick.run(View.java:9080)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.os.Handler.handleCallback(Handler.java:587)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.os.Handler.dispatchMessage(Handler.java:92)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.os.Looper.loop(Looper.java:123)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 16:38:47.529: E/AndroidRuntime(357): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:38:47.529: E/AndroidRuntime(357): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:38:47.529: E/AndroidRuntime(357): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 16:38:47.529: E/AndroidRuntime(357): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 16:38:47.529: E/AndroidRuntime(357): at dalvik.system.NativeStart.main(Native Method)
06-24 16:38:47.529: E/AndroidRuntime(357): Caused by: java.lang.reflect.InvocationTargetException
06-24 16:38:47.529: E/AndroidRuntime(357): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:38:47.529: E/AndroidRuntime(357): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.view.View$1.onClick(View.java:2139)
06-24 16:38:47.529: E/AndroidRuntime(357): ... 11 more
06-24 16:38:47.529: E/AndroidRuntime(357): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
06-24 16:38:47.529: E/AndroidRuntime(357): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.app.Activity.startActivityForResult(Activity.java:2827)
06-24 16:38:47.529: E/AndroidRuntime(357): at android.app.Activity.startActivity(Activity.java:2933)
06-24 16:38:47.529: E/AndroidRuntime(357): at com.myfirstapp.MyFirstActivity.sendMessage(MyFirstActivity.java:26)
06-24 16:38:47.529: E/AndroidRuntime(357): ... 14 more
06-24 16:43:20.070: E/AndroidRuntime(385): FATAL EXCEPTION: main
06-24 16:43:20.070: E/AndroidRuntime(385): java.lang.IllegalStateException: Could not execute method of the activity
06-24 16:43:20.070: E/AndroidRuntime(385): at android.view.View$1.onClick(View.java:2144)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.view.View.performClick(View.java:2485)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.view.View$PerformClick.run(View.java:9080)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.os.Handler.handleCallback(Handler.java:587)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.os.Handler.dispatchMessage(Handler.java:92)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.os.Looper.loop(Looper.java:123)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 16:43:20.070: E/AndroidRuntime(385): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:43:20.070: E/AndroidRuntime(385): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:43:20.070: E/AndroidRuntime(385): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 16:43:20.070: E/AndroidRuntime(385): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 16:43:20.070: E/AndroidRuntime(385): at dalvik.system.NativeStart.main(Native Method)
06-24 16:43:20.070: E/AndroidRuntime(385): Caused by: java.lang.reflect.InvocationTargetException
06-24 16:43:20.070: E/AndroidRuntime(385): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:43:20.070: E/AndroidRuntime(385): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.view.View$1.onClick(View.java:2139)
06-24 16:43:20.070: E/AndroidRuntime(385): ... 11 more
06-24 16:43:20.070: E/AndroidRuntime(385): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
06-24 16:43:20.070: E/AndroidRuntime(385): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.app.Activity.startActivityForResult(Activity.java:2827)
06-24 16:43:20.070: E/AndroidRuntime(385): at android.app.Activity.startActivity(Activity.java:2933)
06-24 16:43:20.070: E/AndroidRuntime(385): at com.myfirstapp.MyFirstActivity.sendMessage(MyFirstActivity.java:26)
06-24 16:43:20.070: E/AndroidRuntime(385): ... 14 more
06-24 16:45:09.099: E/AndroidRuntime(425): FATAL EXCEPTION: main
06-24 16:45:09.099: E/AndroidRuntime(425): java.lang.IllegalStateException: Could not execute method of the activity
06-24 16:45:09.099: E/AndroidRuntime(425): at android.view.View$1.onClick(View.java:2144)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.view.View.performClick(View.java:2485)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.view.View$PerformClick.run(View.java:9080)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.os.Handler.handleCallback(Handler.java:587)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.os.Handler.dispatchMessage(Handler.java:92)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.os.Looper.loop(Looper.java:123)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 16:45:09.099: E/AndroidRuntime(425): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:45:09.099: E/AndroidRuntime(425): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:45:09.099: E/AndroidRuntime(425): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 16:45:09.099: E/AndroidRuntime(425): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 16:45:09.099: E/AndroidRuntime(425): at dalvik.system.NativeStart.main(Native Method)
06-24 16:45:09.099: E/AndroidRuntime(425): Caused by: java.lang.reflect.InvocationTargetException
06-24 16:45:09.099: E/AndroidRuntime(425): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:45:09.099: E/AndroidRuntime(425): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.view.View$1.onClick(View.java:2139)
06-24 16:45:09.099: E/AndroidRuntime(425): ... 11 more
06-24 16:45:09.099: E/AndroidRuntime(425): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
06-24 16:45:09.099: E/AndroidRuntime(425): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.app.Activity.startActivityForResult(Activity.java:2827)
06-24 16:45:09.099: E/AndroidRuntime(425): at android.app.Activity.startActivity(Activity.java:2933)
06-24 16:45:09.099: E/AndroidRuntime(425): at com.myfirstapp.MyFirstActivity.sendMessage(MyFirstActivity.java:26)
06-24 16:45:09.099: E/AndroidRuntime(425): ... 14 more
06-24 18:20:31.070: E/AndroidRuntime(464): FATAL EXCEPTION: main
06-24 18:20:31.070: E/AndroidRuntime(464): java.lang.IllegalStateException: Could not execute method of the activity
06-24 18:20:31.070: E/AndroidRuntime(464): at android.view.View$1.onClick(View.java:2144)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.view.View.performClick(View.java:2485)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.view.View$PerformClick.run(View.java:9080)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.os.Handler.handleCallback(Handler.java:587)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.os.Handler.dispatchMessage(Handler.java:92)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.os.Looper.loop(Looper.java:123)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 18:20:31.070: E/AndroidRuntime(464): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 18:20:31.070: E/AndroidRuntime(464): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 18:20:31.070: E/AndroidRuntime(464): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 18:20:31.070: E/AndroidRuntime(464): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 18:20:31.070: E/AndroidRuntime(464): at dalvik.system.NativeStart.main(Native Method)
06-24 18:20:31.070: E/AndroidRuntime(464): Caused by: java.lang.reflect.InvocationTargetException
06-24 18:20:31.070: E/AndroidRuntime(464): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 18:20:31.070: E/AndroidRuntime(464): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.view.View$1.onClick(View.java:2139)
06-24 18:20:31.070: E/AndroidRuntime(464): ... 11 more
06-24 18:20:31.070: E/AndroidRuntime(464): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
06-24 18:20:31.070: E/AndroidRuntime(464): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.app.Activity.startActivityForResult(Activity.java:2827)
06-24 18:20:31.070: E/AndroidRuntime(464): at android.app.Activity.startActivity(Activity.java:2933)
06-24 18:20:31.070: E/AndroidRuntime(464): at com.myfirstapp.MyFirstActivity.sendMessage(MyFirstActivity.java:26)
06-24 18:20:31.070: E/AndroidRuntime(464): ... 14 more
06-24 18:25:12.590: E/AndroidRuntime(477): FATAL EXCEPTION: main
06-24 18:25:12.590: E/AndroidRuntime(477): java.lang.IllegalStateException: Could not execute method of the activity
06-24 18:25:12.590: E/AndroidRuntime(477): at android.view.View$1.onClick(View.java:2144)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.view.View.performClick(View.java:2485)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.view.View$PerformClick.run(View.java:9080)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.os.Handler.handleCallback(Handler.java:587)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.os.Handler.dispatchMessage(Handler.java:92)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.os.Looper.loop(Looper.java:123)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 18:25:12.590: E/AndroidRuntime(477): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 18:25:12.590: E/AndroidRuntime(477): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 18:25:12.590: E/AndroidRuntime(477): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 18:25:12.590: E/AndroidRuntime(477): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 18:25:12.590: E/AndroidRuntime(477): at dalvik.system.NativeStart.main(Native Method)
06-24 18:25:12.590: E/AndroidRuntime(477): Caused by: java.lang.reflect.InvocationTargetException
06-24 18:25:12.590: E/AndroidRuntime(477): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 18:25:12.590: E/AndroidRuntime(477): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.view.View$1.onClick(View.java:2139)
06-24 18:25:12.590: E/AndroidRuntime(477): ... 11 more
06-24 18:25:12.590: E/AndroidRuntime(477): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
06-24 18:25:12.590: E/AndroidRuntime(477): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.app.Activity.startActivityForResult(Activity.java:2827)
06-24 18:25:12.590: E/AndroidRuntime(477): at android.app.Activity.startActivity(Activity.java:2933)
06-24 18:25:12.590: E/AndroidRuntime(477): at com.myfirstapp.MyFirstActivity.sendMessage(MyFirstActivity.java:26)
06-24 18:25:12.590: E/AndroidRuntime(477): ... 14 more
<code>
not sure as how to debug this app.
Please advice
Thanks
SSAMEERR
Unable to find explicit activity class
{com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity};
have you declared this activity in your AndroidManifest.xml?
put the entry of the DisplayMessageActivity in manifest.......
it DisplayMessageActivity is first Activity use intent-filter other remove that.
<activity android:name=".DisplayMessageActivity" android:label="Demo App">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Add it to the DisplayMessageActivity manifest as
<application ... >
<activity android:name=".DisplayMessageActivity" />
...
</application>
The answer is in the logcat:
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.myfirstapp/DisplayMessageActivity.java.DisplayMessageActivity}; have you declared this activity in your AndroidManifest.xml?
Declare the activity in your manifest like so (i.e. insert it somewhere between the <application> and </application> tags):
<activity android:name=".DisplayMessageActivity" />
This is a common beginners mistake... expect this error at least a couple more times before you get used to it. :)
Make sure your other activities in the project are added to the AndroidManifest.xml
You have to include your activity in Manifest like:
<activity android:name=".MyFirstActivity"
android:theme="#android:style/Theme.NoTitleBar">
</activity>
Related
Google App Invites(Beta) is not working in android 2.3.6 devices.
I tried out in a 4 devices of different versions & it failed only in 2.3.6.
Kindly point me to resources to resolve this error!
Below is the stacktrace
06-16 08:49:13.939 6396-6396/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.android.gms/com.google.android.gms.appinvite.AppInviteActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3687)
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:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.google.android.gms.appinvite.ui.widget.g.<init>(SourceFile:167)
at com.google.android.gms.appinvite.ui.widget.s.b(SourceFile:80)
at com.google.android.gms.appinvite.ui.widget.d.a(SourceFile:76)
at com.google.android.gms.appinvite.ui.context.h.a(SourceFile:409)
at android.support.v4.app.Fragment.b(SourceFile:1786)
at android.support.v4.app.s.a(SourceFile:953)
at android.support.v4.app.s.a(SourceFile:1136)
at android.support.v4.app.a.run(SourceFile:739)
at android.support.v4.app.s.h(SourceFile:1499)
at android.support.v4.app.l.onStart(SourceFile:548)
at com.google.android.gms.appinvite.AppInviteActivity.onStart(SourceFile:270)
I don't know why the app crashes whenever it's supposed to go to the next Activity. I made a practice app that works as it should when using the same format. I uploaded the files to gist.github.
The error is
1216-1216/com.example.chiozokamalu.newfreshstart E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.ArrayIndexOutOfBoundsException
at com.example.chiozokamalu.newfreshstart.MainActivity.onClick(MainActivity.java:164)
at android.view.View.performClick(View.java:2485)
at android.view.View$PerformClick.run(View.java:9080)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
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)
On line 164 of MainActivity.java:
questionView.setText(questions[questionIndex]); // set the text to the next question
EDIT: After Varun helped me, I get a new error which is
1307-1307/com.example.chiozokamalu.newfreshstart E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.chiozokamalu.newfreshstart/com.example.chiozokamalu.newfreshstart.Results1}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
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)
Caused by: java.lang.NullPointerException
at com.example.chiozokamalu.newfreshstart.Results1.onCreate(Results1.java:58)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
at android.app.ActivityThread.access$1500(ActivityThread.java:117)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
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)
The questions array at line no. 164 is going out of bound that means questionIndex is greater than the total length of the questions array. So you should add a check on the length before extracting value from the array.
You have added the check but after that you incremented the value so either you modify the if condition to if (questionIndex < questions.length -1)
or modify the questionIndex variable before the if condition
You are getting problem because you haven't initiated resultView9 that is why it is null and giving nullpointer, just initiatlise it as you done with other and everything is fine. You have initialised the resultView8 twice just add resultview9 over there
I have developed a Android Map Application in Android and Want to Launch It On Google Play.
Problem is that when I Try to Run it On Emulator It Shows this Error in Console
[2013-06-24 10:14:18 - Track] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2013-06-24 10:14:18 - Track] Please check logcat output for more details.
[2013-06-24 10:14:18 - Track] Launch canceled!
Please Any One Help Me To Test it On Emulator and Tell me What Exactly I am Missing or Is There any other problem in it.Thanks in Advance
Update
Log Cat
06-24 14:43:12.462: D/dalvikvm(380): GC_CONCURRENT freed 376K, 48% free 3039K/5831K, external 716K/1038K, paused 5ms+5ms
06-24 14:43:16.303: D/dalvikvm(380): GC_CONCURRENT freed 578K, 50% free 3020K/6023K, external 716K/1038K, paused 5ms+49ms
06-24 14:43:16.863: D/dalvikvm(380): GC_CONCURRENT freed 298K, 47% free 3234K/6023K, external 716K/1038K, paused 5ms+7ms
06-24 14:43:17.193: D/dalvikvm(380): GC_CONCURRENT freed 468K, 47% free 3318K/6215K, external 716K/1038K, paused 5ms+32ms
06-24 14:43:17.643: D/dalvikvm(380): GC_CONCURRENT freed 432K, 46% free 3417K/6279K, external 717K/1038K, paused 5ms+6ms
06-24 14:43:37.943: E/log_tag(380): Error in http connectionjava.net.UnknownHostException: sml.com.pk
06-24 14:43:37.943: E/log_tag(380): Error converting result java.lang.NullPointerException
06-24 14:43:37.963: D/AndroidRuntime(380): Shutting down VM
06-24 14:43:37.974: W/dalvikvm(380): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-24 14:43:37.982: E/AndroidRuntime(380): FATAL EXCEPTION: main
06-24 14:43:37.982: E/AndroidRuntime(380): java.lang.RuntimeException: Unable to start activity ComponentInfo{map2.pkg.pkg/map2.pkg.pkg.GMapsActivity}: java.lang.NullPointerException
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.os.Handler.dispatchMessage(Handler.java:99)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.os.Looper.loop(Looper.java:130)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 14:43:37.982: E/AndroidRuntime(380): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 14:43:37.982: E/AndroidRuntime(380): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 14:43:37.982: E/AndroidRuntime(380): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 14:43:37.982: E/AndroidRuntime(380): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 14:43:37.982: E/AndroidRuntime(380): at dalvik.system.NativeStart.main(Native Method)
06-24 14:43:37.982: E/AndroidRuntime(380): Caused by: java.lang.NullPointerException
06-24 14:43:37.982: E/AndroidRuntime(380): at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:112)
06-24 14:43:37.982: E/AndroidRuntime(380): at org.json.JSONTokener.nextValue(JSONTokener.java:90)
06-24 14:43:37.982: E/AndroidRuntime(380): at org.json.JSONArray.<init>(JSONArray.java:87)
06-24 14:43:37.982: E/AndroidRuntime(380): at org.json.JSONArray.<init>(JSONArray.java:103)
06-24 14:43:37.982: E/AndroidRuntime(380): at map2.pkg.pkg.GMapsActivity.onCreate(GMapsActivity.java:112)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-24 14:43:37.982: E/AndroidRuntime(380): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-24 14:43:37.982: E/AndroidRuntime(380): ... 11 more
06-24 14:44:28.792: I/Process(380): Sending signal. PID: 380 SIG: 9
Sir I Have Created Emulator as Google Inc But Now Again m getting Error Above Log Cat/
1) Install Google map APIs. This can be done in Eclispe
Windows/Android SDK and AVD Manager -> Available Packages -> Third
Party Add-ons -> Google Inc. -> Google APIs by Google Inc., Android
API X
2) From command line create new AVD. This can be done by listing
targets (android list targets), then android create avd -n
new_avd_api_233 -t "Google Inc.:Google APIs:X"
3) Then create AVD in Eclipse Windows/Android SDK and AVD Manager ->
New... -> (Name: new_avd_X, Target: Google APIs (Google Inc.) - API
Level X)
4) Create Android Project in Eclipse File/New/Android Project and
select Google APIs Build Target.
5) add between
tags.
5) Run Project as Android Application.
If you’re installing an apk into the Android Emulator and seeing this
error (INSTALL_FAILED_MISSING_SHARED_LIBRARY), it may mean that the
app relies on the Google APIs (e.g. for Google Maps and the other
Google Android apps) and your AVD that you’re running was created
without the Google APIs.
Create a new AVD from the AVD Manager using the one of the Google API
targets at the API level that you need and you should be good to go.
IBM Worklight v6.0
Using the Worklight Liberty Profile Standalone server with Derby database
Following the infocenter instruction to create the app center apk package.
I have tried to use the installer and also Run As Android Application in the Android emulator. The application fails to start with this error in the emulator "Unfortunately, IBM App Center has stopped".
And the following errors are shown in LogCat.
06-24 00:34:56.640: E/AndroidRuntime(999): FATAL EXCEPTION: main
06-24 00:34:56.640: E/AndroidRuntime(999): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ibm.appcenter/com.ibm.appcenter.AppCenter}: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.ActivityThread.access$600(ActivityThread.java:130)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.os.Handler.dispatchMessage(Handler.java:99)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.os.Looper.loop(Looper.java:137)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.ActivityThread.main(ActivityThread.java:4745)
06-24 00:34:56.640: E/AndroidRuntime(999): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 00:34:56.640: E/AndroidRuntime(999): at java.lang.reflect.Method.invoke(Method.java:511)
06-24 00:34:56.640: E/AndroidRuntime(999): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
06-24 00:34:56.640: E/AndroidRuntime(999): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-24 00:34:56.640: E/AndroidRuntime(999): at dalvik.system.NativeStart.main(Native Method)
06-24 00:34:56.640: E/AndroidRuntime(999): Caused by: java.lang.UnsupportedOperationException: Device does not have package com.google.android.gsf
06-24 00:34:56.640: E/AndroidRuntime(999): at com.google.android.gcm.GCMRegistrar.checkDevice(GCMRegistrar.java:96)
06-24 00:34:56.640: E/AndroidRuntime(999): at com.ibm.mobile.application.main.AbstractAppCenter.onCreate(AbstractAppCenter.java:66)
06-24 00:34:56.640: E/AndroidRuntime(999): at com.ibm.appcenter.AppCenter.onCreate(AppCenter.java:30)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.Activity.performCreate(Activity.java:5008)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
06-24 00:34:56.640: E/AndroidRuntime(999): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
06-24 00:34:56.640: E/AndroidRuntime(999): ... 11 more
Please see a possible solution here: com.google.android.gsf package couldn't be found
Seems to be related to not using the correct settings for the Android emulator.
I changed the emulator's Target from "Android 4.1.2" to "Google APIs (Google Inc) - API 16". Restart the emulator. The AppCenter can start.
However, I got the error on CordovaWebView: TIMEOUT ERROR! which can be solved by this post -
Giving Time out error while opening worklight hybrid app in android emulator
I can across the same problem running the IBM App Center client app on an Intel x86 based emulator, and had to switch to using one with Google APIs, or a device, say Nexus 7. A quick Google search turned up the following post, which mentions that not all devices include the Google APIs (e.g. Amazon Kindle), so this App Center problem could still exist for some users. The post also has a recommendation to catch the exception:
http://www.marvinlabs.com/2013/01/22/avoiding-crashes-when-using-gcm-in-your-android-application/
I am developing in app where I am using an activity in which I'm displaying a list view items page by page by using threading, When the user selects the item it will take the user to another activity.
But Here some times when I click on list view item the app crashes. It says something in log cat but I am unable to understand it.
Here is the Stack Trace:
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): FATAL EXCEPTION: main
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy#4073ef78 is not valid; is your activity running?
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.view.ViewRoot.setView(ViewRoot.java:527)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.view.Window$LocalWindowManager.addView(Window.java:424)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.app.Dialog.show(Dialog.java:241)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at com.usablenet.mobile.walgreen.app.util.ErrorAlertServiceImp.showErrorAlert(ErrorAlertServiceImp.java:86)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at com.usablenet.mobile.walgreen.pharmacy.PrescriptionList.showErrorCodeAlert(PrescriptionList.java:360)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at com.usablenet.mobile.walgreen.pharmacy.PrescriptionList.access$300(PrescriptionList.java:45)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at com.usablenet.mobile.walgreen.pharmacy.PrescriptionList$2.handleMessage(PrescriptionList.java:323)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.os.Handler.dispatchMessage(Handler.java:99)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.os.Looper.loop(Looper.java:130)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at java.lang.reflect.Method.invokeNative(Native Method)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at java.lang.reflect.Method.invoke(Method.java:507)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-24 16:26:44.320: ERROR/AndroidRuntime(4248): at dalvik.system.NativeStart.main(Native Method)
Thanks,
Balu.
Use getApplicationContext for the AlertDialog, otherwise you will get this error when you switch between tasks.
Instead of: AlertDialog.Builder builder = new AlertDialog.Builder(this);
Use:ConnectionDetector = new ConnectionDetector(getApplicationContext());
The same goes for any listeners on the dialog.
Furthermore:
if (!ConnectionDetector.isConnectingToInternet()) {
alert.showAlertDialog(ListActivity.this, "Internet Connection Error","Please connect to working Internet connection", false);
// stop executing code by return
return;
}