1

i have problem with my app. App use SQLite. I tried evrything, and it is still crashing.

There is error logs:

08-16 18:04:55.791: E/AndroidRuntime(1621): FATAL EXCEPTION: main
08-16 18:04:55.791: E/AndroidRuntime(1621): Process: com.example.angielski, PID: 1621
08-16 18:04:55.791: E/AndroidRuntime(1621): java.lang.RuntimeException: Unable to start     activity ComponentInfo{com.example.angielski/com.example.angielski.BaseList}: android.view.InflateException: Binary XML file line #71: Error inflating class <unknown>
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.ActivityThread.access$800(ActivityThread.java:135)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.os.Handler.dispatchMessage(Handler.java:102)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.os.Looper.loop(Looper.java:136)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.ActivityThread.main(ActivityThread.java:5017)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at java.lang.reflect.Method.invokeNative(Native Method)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at java.lang.reflect.Method.invoke(Method.java:515)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at dalvik.system.NativeStart.main(Native Method)
08-16 18:04:55.791: E/AndroidRuntime(1621): Caused by: android.view.InflateException: Binary XML file line #71: Error inflating class <unknown>
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.createView(LayoutInflater.java:620)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.Activity.setContentView(Activity.java:1929)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at com.example.angielski.BaseList.onCreate(BaseList.java:33)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.Activity.performCreate(Activity.java:5231)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
08-16 18:04:55.791: E/AndroidRuntime(1621):     ... 11 more
08-16 18:04:55.791: E/AndroidRuntime(1621): Caused by: java.lang.reflect.InvocationTargetException
08-16 18:04:55.791: E/AndroidRuntime(1621):     at java.lang.reflect.Constructor.constructNative(Native Method)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.LayoutInflater.createView(LayoutInflater.java:594)
08-16 18:04:55.791: E/AndroidRuntime(1621):     ... 24 more
08-16 18:04:55.791: E/AndroidRuntime(1621): Caused by: java.lang.OutOfMemoryError
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.content.res.Resources.loadDrawable(Resources.java:2110)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.content.res.Resources.getDrawable(Resources.java:700)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:176)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:937)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.content.res.Resources.loadDrawable(Resources.java:2092)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.view.View.<init>(View.java:3554)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.widget.TextView.<init>(TextView.java:623)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.widget.Button.<init>(Button.java:107)
08-16 18:04:55.791: E/AndroidRuntime(1621):     at android.widget.Button.<init>(Button.java:103)
08-16 18:04:55.791: E/AndroidRuntime(1621):     ... 27 more

If you need something more of code, just say. I suck...

Help me!

Thanks in advance !

Sorry for my english.

1
  • 1
    Go to line #71 of your xml file. What do you have in this line? Commented Aug 16, 2014 at 22:23

2 Answers 2

5

I have a similar error one time. On line #71 do you have a definition of Button:

<Button
    android:id="@+id/button1"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:layout_marginLeft="30dp"
    android:layout_marginTop="430dp"
    android:background="@drawable/menu_button"
    android:onClick="menu" />

I offer you some solutions to your problem:

  1. Override onLowMemory method on your Activities to free some resources from memory.
  2. Use more WeakReference, SoftReference and WeakHashMap, to avoid strong references, that will be used by the garbage collector to free memory.
  3. Use inSampleSize and inJustDecodeBounds options on BitmapFactory.Options to decode bitmaps, as shown here.
  4. In my particular problem, I decided to reduce the size of the image to use.
  5. Set android:largeHeap = "true" on Manifest as describe here.
Sign up to request clarification or add additional context in comments.

4 Comments

This is not a valid solution. Something goes wrong with memory allocation and freeing resources. This does not fix the problem, just makes it takes a lot more effort to appear.
@Jitsu, this fix the problem to Pawel, when you post a solution let me know.
dont set the android:largeHeap="true". That should be the last option
To avoid future confusion I will put them in order of priority, thanks @eldjon.
1

By increasing the heap size you do not solve the bad memory usage in you program. Working with bitmap is a little tricky and you should be very careful about them. Google developer site has a complete section about working with bitmap which I suggest you should read.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.