Unfortunately,(ProjectName) has been stopped Android [closed] - android

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I already generated API key by giving the MD5 fingureprint from here
https://code.google.com/apis/console/?noredirect#project:413913157166:access
but after running the android application i got error message Unfortunately,(ProjectName) has been stopped Android in the emulator
Need Help.. Thanks in advance
here is my logcat
t. Please make sure your kernel is compiled with file capabilities support enabled.
12-23 01:06:40.713: W/dalvikvm(1663): PR_CAPBSET_DROP 33 failed: Invalid argument. Please make sure your kernel is compiled with file capabilities support enabled.
12-23 01:06:40.744: D/dalvikvm(1663): Not late-enabling CheckJNI (already on)
12-23 01:06:44.634: D/dalvikvm(1663): GC_FOR_ALLOC freed 243K, 11% free 2773K/3104K, paused 41ms, total 47ms
12-23 01:06:44.634: W/CursorWrapperInner(1663): Cursor finalized without prior close()
12-23 01:06:44.645: W/CursorWrapperInner(1663): Cursor finalized without prior close()
12-23 01:06:44.724: D/AndroidRuntime(1663): Shutting down VM
12-23 01:06:44.744: W/dalvikvm(1663): threadid=1: thread exiting with uncaught exception (group=0x41465700)
12-23 01:06:44.824: E/AndroidRuntime(1663): FATAL EXCEPTION: main
12-23 01:06:44.824: E/AndroidRuntime(1663): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.android.map.MapView
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.os.Looper.loop(Looper.java:137)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-23 01:06:44.824: E/AndroidRuntime(1663): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 01:06:44.824: E/AndroidRuntime(1663): at java.lang.reflect.Method.invoke(Method.java:525)
12-23 01:06:44.824: E/AndroidRuntime(1663): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-23 01:06:44.824: E/AndroidRuntime(1663): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-23 01:06:44.824: E/AndroidRuntime(1663): at dalvik.system.NativeStart.main(Native Method)
12-23 01:06:44.824: E/AndroidRuntime(1663): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.android.map.MapView
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-23 01:06:44.824: E/AndroidRuntime(1663): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.Activity.setContentView(Activity.java:1895)
12-23 01:06:44.824: E/AndroidRuntime(1663): at com.example.maps.MainActivity.onCreate(MainActivity.java:16)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.Activity.performCreate(Activity.java:5133)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
12-23 01:06:44.824: E/AndroidRuntime(1663): ... 11 more
12-23 01:06:44.824: E/AndroidRuntime(1663): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.map.MapView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.maps-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.maps-1, /vendor/lib, /system/lib]]
12-23 01:06:44.824: E/AndroidRuntime(1663): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
12-23 01:06:44.824: E/AndroidRuntime(1663): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-23 01:06:44.824: E/AndroidRuntime(1663): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
12-23 01:06:44.824: E/AndroidRuntime(1663): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
12-23 01:06:44.824: E/AndroidRuntime(1663): ... 21 more
12-23 01:06:54.994: I/Process(1663): Sending signal. PID: 1663 SIG: 9
12-23 01:08:58.434: D/dalvikvm(1820): GC_FOR_ALLOC freed 250K, 11% free 2766K/3104K, paused 67ms, total 76ms
12-23 01:08:58.434: W/CursorWrapperInner(1820): Cursor finalized without prior close()
12-23 01:08:58.464: W/CursorWrapperInner(1820): Cursor finalized without prior close()
12-23 01:08:58.624: D/AndroidRuntime(1820): Shutting down VM
12-23 01:08:58.624: W/dalvikvm(1820): threadid=1: thread exiting with uncaught exception (group=0x41465700)
12-23 01:08:58.714: E/AndroidRuntime(1820): FATAL EXCEPTION: main
12-23 01:08:58.714: E/AndroidRuntime(1820): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.android.map.MapView
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.os.Looper.loop(Looper.java:137)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-23 01:08:58.714: E/AndroidRuntime(1820): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 01:08:58.714: E/AndroidRuntime(1820): at java.lang.reflect.Method.invoke(Method.java:525)
12-23 01:08:58.714: E/AndroidRuntime(1820): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-23 01:08:58.714: E/AndroidRuntime(1820): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-23 01:08:58.714: E/AndroidRuntime(1820): at dalvik.system.NativeStart.main(Native Method)
12-23 01:08:58.714: E/AndroidRuntime(1820): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.google.android.map.MapView
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-23 01:08:58.714: E/AndroidRuntime(1820): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.Activity.setContentView(Activity.java:1895)
12-23 01:08:58.714: E/AndroidRuntime(1820): at com.example.maps.MainActivity.onCreate(MainActivity.java:16)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.Activity.performCreate(Activity.java:5133)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
12-23 01:08:58.714: E/AndroidRuntime(1820): ... 11 more
12-23 01:08:58.714: E/AndroidRuntime(1820): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.map.MapView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.maps-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.maps-2, /vendor/lib, /system/lib]]
12-23 01:08:58.714: E/AndroidRuntime(1820): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
12-23 01:08:58.714: E/AndroidRuntime(1820): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-23 01:08:58.714: E/AndroidRuntime(1820): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
12-23 01:08:58.714: E/AndroidRuntime(1820): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
12-23 01:08:58.714: E/AndroidRuntime(1820): ... 21 more
12-23 01:09:10.654: I/Process(1820): Sending signal. PID: 1820 SIG: 9
12-23 01:16:40.084: D/dalvikvm(1913): GC_FOR_ALLOC freed 229K, 11% free 2786K/3104K, paused 47ms, total 52ms
12-23 01:16:40.084: W/CursorWrapperInner(1913): Cursor finalized without prior close()
12-23 01:16:40.095: W/CursorWrapperInner(1913): Cursor finalized without prior close()
12-23 01:16:40.114: D/AndroidRuntime(1913): Shutting down VM
12-23 01:16:40.114: W/dalvikvm(1913): threadid=1: thread exiting with uncaught exception (group=0x41465700)
12-23 01:16:40.146: E/AndroidRuntime(1913): FATAL EXCEPTION: main
12-23 01:16:40.146: E/AndroidRuntime(1913): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class activity
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.os.Looper.loop(Looper.java:137)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-23 01:16:40.146: E/AndroidRuntime(1913): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 01:16:40.146: E/AndroidRuntime(1913): at java.lang.reflect.Method.invoke(Method.java:525)
12-23 01:16:40.146: E/AndroidRuntime(1913): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-23 01:16:40.146: E/AndroidRuntime(1913): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-23 01:16:40.146: E/AndroidRuntime(1913): at dalvik.system.NativeStart.main(Native Method)
12-23 01:16:40.146: E/AndroidRuntime(1913): Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class activity
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-23 01:16:40.146: E/AndroidRuntime(1913): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.Activity.setContentView(Activity.java:1895)
12-23 01:16:40.146: E/AndroidRuntime(1913): at com.example.maps.MainActivity.onCreate(MainActivity.java:16)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.Activity.performCreate(Activity.java:5133)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
12-23 01:16:40.146: E/AndroidRuntime(1913): ... 11 more
12-23 01:16:40.146: E/AndroidRuntime(1913): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.activity" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.maps-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.maps-1, /vendor/lib, /system/lib]]
12-23 01:16:40.146: E/AndroidRuntime(1913): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
12-23 01:16:40.146: E/AndroidRuntime(1913): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-23 01:16:40.146: E/AndroidRuntime(1913): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
12-23 01:16:40.146: E/AndroidRuntime(1913): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
12-23 01:16:40.146: E/AndroidRuntime(1913): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
12-23 01:16:40.146: E/AndroidRuntime(1913): ... 21 more
12-23 01:16:46.515: I/Process(1913): Sending signal. PID: 1913 SIG: 9
12-23 01:25:04.063: D/dalvikvm(1967): GC_FOR_ALLOC freed 232K, 11% free 2784K/3104K, paused 30ms, total 36ms
12-23 01:25:04.063: W/CursorWrapperInner(1967): Cursor finalized without prior close()
12-23 01:25:04.073: W/CursorWrapperInner(1967): Cursor finalized without prior close()
12-23 01:25:04.093: D/AndroidRuntime(1967): Shutting down VM
12-23 01:25:04.093: W/dalvikvm(1967): threadid=1: thread exiting with uncaught exception (group=0x41465700)
12-23 01:25:04.103: E/AndroidRuntime(1967): FATAL EXCEPTION: main
12-23 01:25:04.103: E/AndroidRuntime(1967): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.google.android.map.MapView
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.os.Looper.loop(Looper.java:137)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-23 01:25:04.103: E/AndroidRuntime(1967): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 01:25:04.103: E/AndroidRuntime(1967): at java.lang.reflect.Method.invoke(Method.java:525)
12-23 01:25:04.103: E/AndroidRuntime(1967): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-23 01:25:04.103: E/AndroidRuntime(1967): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-23 01:25:04.103: E/AndroidRuntime(1967): at dalvik.system.NativeStart.main(Native Method)
12-23 01:25:04.103: E/AndroidRuntime(1967): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.google.android.map.MapView
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-23 01:25:04.103: E/AndroidRuntime(1967): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.Activity.setContentView(Activity.java:1895)
12-23 01:25:04.103: E/AndroidRuntime(1967): at com.example.maps.MainActivity.onCreate(MainActivity.java:16)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.Activity.performCreate(Activity.java:5133)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
12-23 01:25:04.103: E/AndroidRuntime(1967): ... 11 more
12-23 01:25:04.103: E/AndroidRuntime(1967): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.map.MapView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.maps-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.maps-2, /vendor/lib, /system/lib]]
12-23 01:25:04.103: E/AndroidRuntime(1967): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
12-23 01:25:04.103: E/AndroidRuntime(1967): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-23 01:25:04.103: E/AndroidRuntime(1967): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
12-23 01:25:04.103: E/AndroidRuntime(1967): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
12-23 01:25:04.103: E/AndroidRuntime(1967): ... 21 more
12-23 01:25:22.094: I/Process(1967): Sending signal. PID: 1967 SIG: 9
12-23 01:27:40.973: D/dalvikvm(2025): GC_FOR_ALLOC freed 233K, 11% free 2783K/3104K, paused 32ms, total 38ms
12-23 01:27:40.973: W/CursorWrapperInner(2025): Cursor finalized without prior close()
12-23 01:27:40.973: W/CursorWrapperInner(2025): Cursor finalized without prior close()
12-23 01:27:41.003: D/AndroidRuntime(2025): Shutting down VM
12-23 01:27:41.003: W/dalvikvm(2025): threadid=1: thread exiting with uncaught exception (group=0x41465700)
12-23 01:27:41.023: E/AndroidRuntime(2025): FATAL EXCEPTION: main
12-23 01:27:41.023: E/AndroidRuntime(2025): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.maps/com.example.maps.MainActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class com.google.android.map.MapView
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.os.Handler.dispatchMessage(Handler.java:99)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.os.Looper.loop(Looper.java:137)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.ActivityThread.main(ActivityThread.java:5103)
12-23 01:27:41.023: E/AndroidRuntime(2025): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 01:27:41.023: E/AndroidRuntime(2025): at java.lang.reflect.Method.invoke(Method.java:525)
12-23 01:27:41.023: E/AndroidRuntime(2025): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
12-23 01:27:41.023: E/AndroidRuntime(2025): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-23 01:27:41.023: E/AndroidRuntime(2025): at dalvik.system.NativeStart.main(Native Method)
12-23 01:27:41.023: E/AndroidRuntime(2025): Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class com.google.android.map.MapView
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
12-23 01:27:41.023: E/AndroidRuntime(2025): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:267)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.Activity.setContentView(Activity.java:1895)
12-23 01:27:41.023: E/AndroidRuntime(2025): at com.example.maps.MainActivity.onCreate(MainActivity.java:16)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.Activity.performCreate(Activity.java:5133)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
12-23 01:27:41.023: E/AndroidRuntime(2025): ... 11 more
12-23 01:27:41.023: E/AndroidRuntime(2025): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.map.MapView" on path: DexPathList[[zip file "/system/framework/com.google.android.maps.jar", zip file "/data/app/com.example.maps-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.maps-1, /vendor/lib, /system/lib]]
12-23 01:27:41.023: E/AndroidRuntime(2025): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
12-23 01:27:41.023: E/AndroidRuntime(2025): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-23 01:27:41.023: E/AndroidRuntime(2025): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.createView(LayoutInflater.java:559)
12-23 01:27:41.023: E/AndroidRuntime(2025): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
12-23 01:27:41.023: E/AndroidRuntime(2025): ... 21 more
12-23 01:32:41.724: I/Process(2025): Sending signal. PID: 2025 SIG: 9
HERE IS MY MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.maps"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-library android:name ="com.google.android.maps"/>
<activity
android:name="com.example.maps.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
</i>
HERE IS MY ACTIVITY CLASS
package com.example.maps;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends MapActivity {
MapView map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
map = (MapView)findViewById(R.id.mvMainActivity);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
#Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
HERE IS MY XML->LAYOUT FILE
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<com.google.android.map.MapView
android:id = "#+id/mvMainActivity"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:clickable="true"
android:apiKey = "AIzaSyBq4zldj_kQVdwGt9ru-nWSSOJ0ORUBuFE"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/hello_world" />
</RelativeLayout>

I would recommend you update the ADK's libraries. This question's answer details how to update your libraries.
Furthermore, verify that the libraries you imported for com.google.android.maps have been added to your build path. It seems an off thing to check but working with Android, I have seen many stranger things!
Edit: As stated by one of the comments, the deprecated maps library might be the culprit. If the update does not fix the problem. Try raising the minimum version you are targeting. Legacy support is nice but often induces more problems than it solves. Unless it is of crucial importance to you, I would personally only target the latest release which I believe was API version 14 or 16.

yup as Raghunandan said you are using Google maps API V1 which is deprecated one. Follow this link for Convert it to API V2.
And also you can try this code which I got map on my emulator.

Related

AVD crashes saying 'Unfortunately, libcocos2dx has crashed'

I just loaded my app created by cocos2dx-3.10 and when I open with it an AVD (again I haven't done any modifications to the app) the app crashes and gives the error: Unfortunately, libcocos2dx has crashed.
here is what I get in my android Monitor:
03-05 18:34:56.668 1435-1435/? D/dalvikvm: Not late-enabling CheckJNI (already on)
03-05 18:34:56.989 1435-1435/com.trying.name E/Trace: error opening trace file: No such file or directory (2)
03-05 18:34:57.419 1435-1435/com.trying.name D/AndroidRuntime: Shutting down VM
03-05 18:34:57.419 1435-1435/com.trying.name W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xb2f2b288)
03-05 18:34:57.518 1435-1435/com.trying.name E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.UnsatisfiedLinkError: Couldn't load cocos2dcpp: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:365)
at java.lang.System.loadLibrary(System.java:535)
at org.cocos2dx.lib.Cocos2dxActivity.onLoadNativeLibraries(Cocos2dxActivity.java:248)
at org.cocos2dx.lib.Cocos2dxActivity.onCreate(Cocos2dxActivity.java:263)
at android.app.Activity.performCreate(Activity.java:5008)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
03-05 18:35:11.559 1435-1435/? I/Process: Sending signal. PID: 1435 SIG: 9

direct event insert to attendees table exceotion if sdk versio lower than 19

I am building an application in which I am inserting events directly to the calendar plus I left the possibility to invite someone else and everything is perfectly fine if I execute it on android sdk version 19 and above, on lower versions I get an exception.
Here is the source:
ContentResolver atend = getContentResolver();
ContentValues val = new ContentValues();
val.put(CalendarContract.Attendees.ATTENDEE_NAME, "Bajo");
val.put(CalendarContract.Attendees.ATTENDEE_EMAIL, someonesEmail);
val.put(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP, CalendarContract.Attendees.RELATIONSHIP_ATTENDEE);
val.put(CalendarContract.Attendees.ATTENDEE_TYPE, CalendarContract.Attendees.TYPE_REQUIRED);
val.put(CalendarContract.Attendees.ATTENDEE_STATUS, CalendarContract.Attendees.ATTENDEE_STATUS_INVITED);
val.put(CalendarContract.Attendees.EVENT_ID, eventID);
Uri muri= atend.insert(CalendarContract.Attendees.CONTENT_URI, val);
Log.d("Atendees URI:",muri.toString());
long Aeventid=Long.parseLong(muri.getLastPathSegment());
the Exception:
03-05 19:45:59.681 1255-1266/? E/DatabaseUtils﹕ Writing exception to parcel
android.database.sqlite.SQLiteDoneException
at android.database.sqlite.SQLiteConnection.nativeExecuteForLong(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:591)
at android.database.sqlite.SQLiteSession.executeForLong(SQLiteSession.java:652)
at android.database.sqlite.SQLiteStatement.simpleQueryForLong(SQLiteStatement.java:107)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:816)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:804)
at com.android.providers.calendar.CalendarDatabaseHelper.duplicateEvent(CalendarDatabaseHelper.java:3311)
at com.android.providers.calendar.CalendarProvider2.insertInTransaction(CalendarProvider2.java:2265)
at com.android.providers.calendar.SQLiteContentProvider.insert(SQLiteContentProvider.java:96)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:201)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:148)
at android.os.Binder.execTransact(Binder.java:367)
at dalvik.system.NativeStart.run(Native Method)
03-05 19:45:59.681 1632-1632/? D/AndroidRuntime﹕ Shutting down VM
03-05 19:45:59.681 1632-1632/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2f7e288)
03-05 19:45:59.681 1632-1632/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3591)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3586)
            at android.view.View.performClick(View.java:4084)
            at android.view.View$PerformClick.run(View.java:16966)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            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:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:184)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:420)
at android.content.ContentResolver.insert(ContentResolver.java:864)
at com.example.rusev.vetcalendar.MainActivity.insertToCalendarImmunization(MainActivity.java:809)
at com.example.rusev.vetcalendar.MainActivity.syncToCalendar(MainActivity.java:931)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at android.view.View$1.onClick(View.java:3586)
            at android.view.View.performClick(View.java:4084)
            at android.view.View$PerformClick.run(View.java:16966)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            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:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
Can you help me to identify what I miss?

My app freezes crashes when it's supposed to go to the next activity

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

Cordova hello world app crashing

I am new in Android Development. I am working on cordova platform
I have created a sample hello world app and getting this error when i am trying to open it in genymotion. ALthough the app compile succesfully but when i run it in genymotion it just shows the prompt with text "Unfortunately "APP" has stopped."
The Error log shows.
01-12 08:16:04.867 2073-2073/com.technoserves.crudnew D/dalvikvm﹕ Late-enabling CheckJNI
01-12 08:16:06.107 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ Unable to resolve superclass of Lcom/technoserves/crudnew/CordovaApp; (14)
01-12 08:16:06.119 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ Link of class 'Lcom/technoserves/crudnew/CordovaApp;' failed
01-12 08:16:06.135 2073-2073/com.technoserves.crudnew D/AndroidRuntime﹕ Shutting down VM
01-12 08:16:06.135 2073-2073/com.technoserves.crudnew W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa6142908)
01-12 08:16:06.155 2073-2073/com.technoserves.crudnew E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.technoserves.crudnew/com.technoserves.crudnew.CordovaApp}: java.lang.ClassNotFoundException: Didn't find class "com.technoserves.crudnew.CordovaApp" on path: /data/app/com.technoserves.crudnew-1.apk
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
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:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.technoserves.crudnew.CordovaApp" on path: /data/app/com.technoserves.crudnew-1.apk
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
            at android.app.ActivityThread.access$600(ActivityThread.java:141)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:5041)
            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:793)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
            at dalvik.system.NativeStart.main(Native Method)
01-12 08:16:22.399 2073-2073/com.technoserves.crudnew I/Process﹕ Sending signal. PID: 2073 SIG: 9
I have updated my cordova to resolve but still same error however a few days ago it was working fine and i have build some apps.
First download Cordova jar file from following link:
http://www.java2s.com/Code/JarDownload/cordova/cordova-1.8.1.jar.zip
after that extract the folder and put cordova-1.8.1 inside your libs folder of project in eclipse
And right click on your project--> properties and Select Android from left pane and scroll to bottom remove the cordova library if added.
then clean and build your project.

Android runtime error

I was trying a sample android code but it gives fatal error when I try to work. Logcat message is below:
12-23 10:23:47.436: E/AndroidRuntime(14565): FATAL EXCEPTION: main
12-23 10:23:47.436: E/AndroidRuntime(14565): Process: com.example.proje, PID: 14565
12-23 10:23:47.436: E/AndroidRuntime(14565): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.proje/com.example.proje.ActivityMain}: java.lang.NullPointerException
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2363)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.ActivityThread.access$900(ActivityThread.java:161)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1265)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.os.Handler.dispatchMessage(Handler.java:102)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.os.Looper.loop(Looper.java:157)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.ActivityThread.main(ActivityThread.java:5356)
12-23 10:23:47.436: E/AndroidRuntime(14565): at java.lang.reflect.Method.invokeNative(Native Method)
12-23 10:23:47.436: E/AndroidRuntime(14565): at java.lang.reflect.Method.invoke(Method.java:515)
12-23 10:23:47.436: E/AndroidRuntime(14565): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
12-23 10:23:47.436: E/AndroidRuntime(14565): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
12-23 10:23:47.436: E/AndroidRuntime(14565): at dalvik.system.NativeStart.main(Native Method)
12-23 10:23:47.436: E/AndroidRuntime(14565): Caused by: java.lang.NullPointerException
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.Activity.findViewById(Activity.java:1970)
12-23 10:23:47.436: E/AndroidRuntime(14565): at com.example.proje.ActivityMain.<init>(ActivityMain.java:20)
12-23 10:23:47.436: E/AndroidRuntime(14565): at java.lang.Class.newInstanceImpl(Native Method)
12-23 10:23:47.436: E/AndroidRuntime(14565): at java.lang.Class.newInstance(Class.java:1208)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.Instrumentation.newActivity(Instrumentation.java:1079)
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2222)
12-23 10:23:47.436: E/AndroidRuntime(14565): ... 11 more
12-23 10:23:47.436: E/AndroidRuntime(14565): Caused by: java.lang.NullPointerException
12-23 10:23:47.436: E/AndroidRuntime(14565): at android.app.Activity.findViewById(Activity.java:1970)
12-23 10:23:47.436: E/AndroidRuntime(14565): at com.example.proje.ActivityMain.<init>
You're calling findViewById() too early, in object initialization phase such as constructor or member variables initialization. You cannot call any activity methods like findViewById() before onCreate(). Move the call to onCreate(). Also place it after setContentView() so you can get a non-null value.

Categories

Resources