我的应用程序有问题。应用程序使用SQLite。我尝试了evrything,它仍在崩溃。
有错误日志:
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
如果您需要更多代码,请说明。我很糟糕......
帮助我!
提前致谢!
抱歉我的英文。
答案 0 :(得分:5)
我有一次类似的错误。在第71行,您有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" />
我为您解决问题:
答案 1 :(得分:1)
通过增加堆大小,您无法解决程序中的内存使用不良问题。使用位图有点棘手,你应该非常小心它们。 Google开发者网站有关于使用位图的complete section,我建议您阅读。