error inflating class - android

I am fairly new to all this, so please bear with me! I have been trying to work out the style of my app today, and cant quite get it. I keep getting this error inflating class when I try to run the app on my AVD. I have no clue what it means, or how to fix it. I can tell its talking about my MainActivity, so Ill post the information for that as well.
07-29 21:41:35.751: D/dalvikvm(431): GC_EXTERNAL_ALLOC freed 53K, 53% free 2546K/5379K, external 1625K/2137K, paused 104ms
07-29 21:41:35.811: E/dalvikvm-heap(431): 31740000-byte external allocation too large for this process.
07-29 21:41:35.911: E/GraphicsJNI(431): VM won't let us allocate 31740000 bytes
07-29 21:41:35.911: D/dalvikvm(431): GC_FOR_MALLOC freed <1K, 53% free 2546K/5379K, external 1625K/2137K, paused 91ms
07-29 21:41:35.911: D/skia(431): --- decoder->decode returned false
07-29 21:41:35.971: D/AndroidRuntime(431): Shutting down VM
07-29 21:41:35.971: W/dalvikvm(431): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-29 21:41:36.021: E/AndroidRuntime(431): FATAL EXCEPTION: main
07-29 21:41:36.021: E/AndroidRuntime(431): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.madonk.louisiana.festivals/com.madonk.louisiana.festivals.MainActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.os.Looper.loop(Looper.java:123)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Method.invokeNative(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Method.invoke(Method.java:507)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-29 21:41:36.021: E/AndroidRuntime(431): at dalvik.system.NativeStart.main(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.RelativeLayout
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.Activity.setContentView(Activity.java:1657)
07-29 21:41:36.021: E/AndroidRuntime(431): at com.madonk.louisiana.festivals.MainActivity.onCreate(MainActivity.java:16)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
07-29 21:41:36.021: E/AndroidRuntime(431): ... 11 more
07-29 21:41:36.021: E/AndroidRuntime(431): Caused by: java.lang.reflect.InvocationTargetException
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Constructor.constructNative(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
07-29 21:41:36.021: E/AndroidRuntime(431): ... 21 more
07-29 21:41:36.021: E/AndroidRuntime(431): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:460)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.content.res.Resources.loadDrawable(Resources.java:1709)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.View.<init>(View.java:1951)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.View.<init>(View.java:1899)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.view.ViewGroup.<init>(ViewGroup.java:286)
07-29 21:41:36.021: E/AndroidRuntime(431): at android.widget.RelativeLayout.<init>(RelativeLayout.java:173)
07-29 21:41:36.021: E/AndroidRuntime(431): ... 24 more
07-29 21:42:43.762: I/Process(431): Sending signal. PID: 431 SIG: 9
Main_Activity.xml
<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="wrap_content"
android:background="#drawable/background" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="39dp"
android:text="#string/Definitive"
android:textColor="#style/AppTheme"
android:textSize="20dp"
android:textStyle="bold"
tools:context=".MainActivity" />
<Button
android:id="#+id/button_southwest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="136dp"
android:onClick="showOther"
android:text="#string/Southwest" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_centerHorizontal="true"
android:text="#string/Select_a_region"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#style/AppTheme"
android:textSize="20dp" />
</RelativeLayout>

Looks like your background drawable is too big, try to run app without background for RelativeLayout. Consider using color instead of drawable for your background.

You cannot use uppercase letters when naming resources in Android. Here you have #string/Definitive and #string/Select_a_region. Rename those and you should be fine. Hope this helps.

Related

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

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.

Error coming while running android application

I have created an android application using eclipse but application is not running on AVD it is saying "Unfortunately has stopped working"
Log cat message is given below -
07-29 04:59:50.789: W/dalvikvm(784): threadid=1: thread exiting with uncaught exception (group=0x414c4700)
07-29 04:59:50.808: E/AndroidRuntime(784): FATAL EXCEPTION: main
07-29 04:59:50.808: E/AndroidRuntime(784): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.androidlove/com.example.androidlove.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.example.androidlove.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.androidlove-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.androidlove-1, /system/lib]]
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.ActivityThread.access$600(ActivityThread.java:141)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.os.Handler.dispatchMessage(Handler.java:99)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.os.Looper.loop(Looper.java:137)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.ActivityThread.main(ActivityThread.java:5103)
07-29 04:59:50.808: E/AndroidRuntime(784): at java.lang.reflect.Method.invokeNative(Native Method)
07-29 04:59:50.808: E/AndroidRuntime(784): at java.lang.reflect.Method.invoke(Method.java:525)
07-29 04:59:50.808: E/AndroidRuntime(784): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
07-29 04:59:50.808: E/AndroidRuntime(784): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
07-29 04:59:50.808: E/AndroidRuntime(784): at dalvik.system.NativeStart.main(Native Method)
07-29 04:59:50.808: E/AndroidRuntime(784): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.example.androidlove.MainActivity" on path: DexPathList[[zip file "/data/app/com.example.androidlove-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.androidlove-1, /system/lib]]
07-29 04:59:50.808: E/AndroidRuntime(784): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
07-29 04:59:50.808: E/AndroidRuntime(784): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
07-29 04:59:50.808: E/AndroidRuntime(784): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
07-29 04:59:50.808: E/AndroidRuntime(784): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
07-29 04:59:50.808: E/AndroidRuntime(784): ... 11 more
07-29 04:59:58.399: I/Process(784): Sending signal. PID: 784 SIG: 9
Please help me i am tired of solving this error.....
I faced the same problem and I found the sample code was put in the "JAVA" folder instead of the "src" folder. After moving the code to src, the problem was solved.
I hope that works.
add the mainActivity in menifest according your package name if package is: com.example.androidlove-1
<activity
android:name="com.example.androidlove-1.MainActivity" >
</activity>
You did not declare MainActivity class in the manifest.xml.
<activity
android:name=".MainActivity" >
</activity>

java.lang.UnsatisfiedLinkError: debugLevel

Alright, I've been going thru posts left and right trying to figure out this error.. I've managed to fix a few errors, but this is just driving me nuts.. it has almost no information.. or atleast none that makes any sense to me.
D/dalvikvm(431): Trying to load lib /data/data/com.hyperlinkup.manglerbt/lib/libventrilo_interface.so 0x405156c8
D/dalvikvm(431): Added shared lib /data/data/com.hyperlinkup.manglerbt/lib/libventrilo_interface.so 0x405156c8
D/dalvikvm(431): No JNI_OnLoad found in /data/data/com.hyperlinkup.manglerbt/lib/libventrilo_interface.so 0x405156c8, skipping init
D/dalvikvm(431): GC_EXTERNAL_ALLOC freed 61K, 53% free 2565K/5379K, external 1027K/1038K, paused 89ms
W/dalvikvm(431): No implementation found for native Lcom/hyperlinkup/manglerbt/VentriloInterface;.debuglevel (I)I
D/AndroidRuntime(431): Shutting down VM
W/dalvikvm(431): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime(431): FATAL EXCEPTION: main
E/AndroidRuntime(431): java.lang.UnsatisfiedLinkError: debuglevel
E/AndroidRuntime(431): at com.hyperlinkup.manglerbt.VentriloInterface.debuglevel(Native Method)
E/AndroidRuntime(431): at com.hyperlinkup.manglerbt.ServerList.onCreate(ServerList.java:96)
E/AndroidRuntime(431): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(431): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime(431): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime(431): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(431): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime(431): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(431): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(431): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(431): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(431): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(431): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(431): at dalvik.system.NativeStart.main(Native Method)
I/Process(431): Sending signal. PID: 431 SIG: 9
I'm trying to rework the Mangler app to use Bluetooth recording (via startBluetoothSco), but I want to make sure the original is working before incorporating the bluetooth functionality.. Any help I can get on this matter would be greatly appreciated.
edit: thinking maybe my issue is with jni_wrappers.c.. first 3 #include's are unresolved.. original build was on linux system it would appear, so it's looking for jni.h, stdint.h and ventrilo3.h
Answer is in the Logcat Stacktrace itself
No implementation found for native Lcom/hyperlinkup/manglerbt/VentriloInterface;.debuglevel (I)I D/AndroidRuntime(431): Shutting down VM
There is a Native method called debuglevel in VentriloInterface. You have not implemented that method. So, the VM throws java.lang.UnsatisfiedLinkError.

Memory Error during frame animation in Android application

Hi im trying to set up a frame animation with a series of images as a background for my splash page in an android application at the moment there is no errors but when I run the application it quits unexpectedly. The first error which follows 10 garbage collections is E/dalvikvm-heap(276): 1234272-byte external allocation too large for this process. I have 17 images I am using for the frame animation each of them are 50k or less so I dont think that the image sizes can be the issue.
The java code I have implemented in my main activity is as follows:
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView frameanimation = (ImageView) findViewById(R.id.frame_animation);
AnimationDrawable frame_animation = (AnimationDrawable) frameanimation.getBackground();
frame_animation.setVisible(true, true);
frame_animation.start();
}
I then have this code implementing an image view within my XML Layout file:
<ImageView
android:id="#+id/frame_animation"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="#drawable/frame_animation"
android:background="#drawable/frame_animation"/>
and finally I have my animation drawable saved as 'frame_animation.xml' within my drawable folder.
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false">
<item android:drawable="#drawable/homebckgrnda1" android:duration="200" />
<item android:drawable="#drawable/homebckgrnda2" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda3" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda4" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda5" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda6" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda7" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda8" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda9" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda10" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda11" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda12" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda13" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda14" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda15" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda16" android:duration="50" />
<item android:drawable="#drawable/homebckgrnda17" android:duration="50" />
</animation-list>
The full LogCat log that I get when running the application is shown here:
04-16 13:51:33.703: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 906 objects / 64688 bytes in 69ms
04-16 13:51:33.983: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 208 objects / 9952 bytes in 66ms
04-16 13:51:34.203: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 54 objects / 2112 bytes in 51ms
04-16 13:51:34.443: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 13 objects / 536 bytes in 52ms
04-16 13:51:34.683: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 13 objects / 512 bytes in 54ms
04-16 13:51:35.133: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 20 objects / 824 bytes in 52ms
04-16 13:51:35.593: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 26 objects / 1216 bytes in 70ms
04-16 13:51:36.023: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 24 objects / 1008 bytes in 51ms
04-16 13:51:36.394: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 26 objects / 1128 bytes in 55ms
04-16 13:51:36.803: D/dalvikvm(276): GC_EXTERNAL_ALLOC freed 24 objects / 984 bytes in 50ms
04-16 13:51:37.143: E/dalvikvm-heap(276): 1234272-byte external allocation too large for this process.
04-16 13:51:37.143: E/GraphicsJNI(276): VM won't let us allocate 1234272 bytes
04-16 13:51:37.153: D/AndroidRuntime(276): Shutting down VM
04-16 13:51:37.153: W/dalvikvm(276): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
04-16 13:51:37.203: E/AndroidRuntime(276): FATAL EXCEPTION: main
04-16 13:51:37.203: E/AndroidRuntime(276): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.BadmintonTrain/com.android.BadmintonTrain.BadmintonTrainActivity}: android.view.InflateException: Binary XML file line #19: Error inflating class android.widget.ImageView
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.os.Handler.dispatchMessage(Handler.java:99)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.os.Looper.loop(Looper.java:123)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.main(ActivityThread.java:4627)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Method.invoke(Method.java:521)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-16 13:51:37.203: E/AndroidRuntime(276): at dalvik.system.NativeStart.main(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class android.widget.ImageView
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.Activity.setContentView(Activity.java:1647)
04-16 13:51:37.203: E/AndroidRuntime(276): at com.android.BadmintonTrain.BadmintonTrainActivity.onCreate(BadmintonTrainActivity.java:21)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
04-16 13:51:37.203: E/AndroidRuntime(276): ... 11 more
04-16 13:51:37.203: E/AndroidRuntime(276): Caused by: java.lang.reflect.InvocationTargetException
04-16 13:51:37.203: E/AndroidRuntime(276): at android.widget.ImageView.<init>(ImageView.java:108)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Constructor.constructNative(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-16 13:51:37.203: E/AndroidRuntime(276): ... 22 more
04-16 13:51:37.203: E/AndroidRuntime(276): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.nativeCreate(Native Method)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.Resources.loadDrawable(Resources.java:1709)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.Resources.getDrawable(Resources.java:581)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:265)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:788)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:729)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.Resources.loadDrawable(Resources.java:1694)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.view.View.<init>(View.java:1885)
04-16 13:51:37.203: E/AndroidRuntime(276): at android.widget.ImageView.<init>(ImageView.java:112)
Any help is much appreciated, I just cannot figure out what is causing the problem.
Thanks
The images you are using might be too large for an animation. How large are they? In an animation, Android loads all of the images into memory and uncompresses them meaning that every pixel will take 4 bytes. So 50k would mean that your image is 111px x 111px. It seems from the error each frame is about 480 x 640, which is really large. Try using smaller images.

Unable to load Android image (ImageView) in emulator due to out of memory?

I am new to Android development and have encountered an error with loading an image into an activity.
The following is what I see from the log in eclipse:
04-15 19:55:36.316: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed 41K, 53% free 2551K/5379K, external 1625K/2137K, paused 180ms
04-15 19:55:36.756: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed 1K, 53% free 2550K/5379K, external 4025K/5027K, paused 42ms
04-15 19:55:37.296: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed 2K, 53% free 2560K/5379K, external 5570K/5597K, paused 52ms
04-15 19:55:41.306: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed 10K, 53% free 2579K/5379K, external 6677K/7260K, paused 43ms
04-15 19:55:41.685: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed 1K, 53% free 2578K/5379K, external 9077K/11125K, paused 51ms
04-15 19:55:41.986: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed <1K, 53% free 2580K/5379K, external 9377K/11777K, paused 41ms
04-15 19:55:42.695: D/dalvikvm(3317): GC_EXTERNAL_ALLOC freed 1K, 53% free 2578K/5379K, external 13794K/15842K, paused 51ms
04-15 19:55:42.725: E/dalvikvm-heap(3317): 10181472-byte external allocation too large for this process.
04-15 19:55:42.766: E/GraphicsJNI(3317): VM won't let us allocate 10181472 bytes
04-15 19:55:42.766: D/dalvikvm(3317): GC_FOR_MALLOC freed 0K, 53% free 2578K/5379K, external 13794K/15842K, paused 33ms
04-15 19:55:42.775: D/AndroidRuntime(3317): Shutting down VM
04-15 19:55:42.775: W/dalvikvm(3317): threadid=1: thread exiting with uncaught exception (group=0x40015560)
04-15 19:55:42.815: E/AndroidRuntime(3317): FATAL EXCEPTION: main
04-15 19:55:42.815: E/AndroidRuntime(3317): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.digitest.sample/com.digitest.sample.SafetyActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class android.widget.ImageView
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.os.Handler.dispatchMessage(Handler.java:99)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.os.Looper.loop(Looper.java:123)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-15 19:55:42.815: E/AndroidRuntime(3317): at java.lang.reflect.Method.invokeNative(Native Method)
04-15 19:55:42.815: E/AndroidRuntime(3317): at java.lang.reflect.Method.invoke(Method.java:507)
04-15 19:55:42.815: E/AndroidRuntime(3317): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-15 19:55:42.815: E/AndroidRuntime(3317): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-15 19:55:42.815: E/AndroidRuntime(3317): at dalvik.system.NativeStart.main(Native Method)
04-15 19:55:42.815: E/AndroidRuntime(3317): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class android.widget.ImageView
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
04-15 19:55:42.815: E/AndroidRuntime(3317): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-15 19:55:42.815: E/AndroidRuntime(3317): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.Activity.setContentView(Activity.java:1657)
04-15 19:55:42.815: E/AndroidRuntime(3317): at com.digitest.sample.SafetyActivity.onCreate(SafetyActivity.java:14)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
04-15 19:55:42.815: E/AndroidRuntime(3317): ... 11 more
04-15 19:55:42.815: E/AndroidRuntime(3317): Caused by: java.lang.reflect.InvocationTargetException
04-15 19:55:42.815: E/AndroidRuntime(3317): at java.lang.reflect.Constructor.constructNative(Native Method)
04-15 19:55:42.815: E/AndroidRuntime(3317): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
04-15 19:55:42.815: E/AndroidRuntime(3317): ... 22 more
04-15 19:55:42.815: E/AndroidRuntime(3317): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.Bitmap.nativeCreate(Native Method)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.content.res.Resources.loadDrawable(Resources.java:1709)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.widget.ImageView.<init>(ImageView.java:118)
04-15 19:55:42.815: E/AndroidRuntime(3317): at android.widget.ImageView.<init>(ImageView.java:108)
04-15 19:55:42.815: E/AndroidRuntime(3317): ... 25 more
My image is a png image and is only about 130KB in size, although the dimension is 741x1526px. But I can't image why the emulator cannot handle such an image size. I loaded a smaller version of this image, which is about 120KB in size with a dimension of 370 × 762px and it is loaded just fine.
Here is how I implement the imageview activity:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#drawable/safety_base" >
<ImageView
android:id="#+id/imgSafety"
android:contentDescription="#string/imgSafety_desc"
android:layout_width="1000dp"
android:layout_height="wrap_content"
android:maxHeight="180dp"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:background="#android:color/transparent"
android:src="#drawable/safety_info_large" />
</RelativeLayout>
Any idea why?
Thanks in advance.
you gave width 1000dp and height 180dp. Reduce width or make it "fill_parent" or "wrap_content". Between, in which emulator have you tried?
You can over-ride the Activity's onLowMemory() method for custom handling such scenarios.
Like Seshu said, keep your sizes realistic. Having a 1000dp wide image with a screen nowhere near 1k dp is silly. Check out the following from the dev guide for more info.
Displaying Bitmap Resources
Displaying Large Bitmaps
EDIT
Another alternative could be to load the image into a WebView for scrolling and zooming capabilities.

Categories

Resources