[英]App crashes after launch
此应用程序可以正常工作,可以减少图像的数量,但可以减少图像的大小。但是我需要使用大量图像,无法安装在手机内存中,因此尝试在sd卡上安装该应用程序这个错误。 不明白为什么。 如何解决这个问题
这就是原木猫说的
E/dalvikvm-heap(17405): Out of memory on a 3234424-byte allocation.
E/AndroidRuntime(17405): FATAL EXCEPTION: main
E/AndroidRuntime(17405): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mystictreegames.pagecurl/com.mystictreegames.pagecurl.StandaloneExample}: android.view.InflateException: Binary XML file line #6: Error inflating class com.mystictreegames.pagecurl.PageCurlView
E/AndroidRuntime(17405): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2343)
E/AndroidRuntime(17405): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2395)
E/AndroidRuntime(17405): at android.app.ActivityThread.access$600(ActivityThread.java:162)
E/AndroidRuntime(17405): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)
E/AndroidRuntime(17405): at android.os.Handler.dispatchMessage(Handler.java:107)
E/AndroidRuntime(17405): at android.os.Looper.loop(Looper.java:194)
E/AndroidRuntime(17405): at android.app.ActivityThread.main(ActivityThread.java:5371)
E/AndroidRuntime(17405): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17405): at java.lang.reflect.Method.invoke(Method.java:525)
E/AndroidRuntime(17405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
E/AndroidRuntime(17405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
E/AndroidRuntime(17405): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(17405): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class com.mystictreegames.pagecurl.PageCurlView
E/AndroidRuntime(17405): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
我的存储卡几乎快用完了。
这是standalone_example.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.mystictreegames.pagecurl.PageCurlView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/dcgpagecurlPageCurlView1"
android:background="@drawable/background">
</com.mystictreegames.pagecurl.PageCurlView>
</LinearLayout>
并且我的main.xml只包含一个imagebutton我应该发布它吗?
确保将PageCurlView
放置在com.mystictreegames.pagecurl
您必须使用bitmap.recycle()回收位图。 如果不回收位图,则可能会遇到内存不足异常的风险。
所以用
bitmap.recycle();
bitmap = null;
这将确保位图被垃圾收集。
否则,如果这是内存问题,则可以使用
android:largeHeap="true"
在清单应用程序标记中。 这将允许您加载更多的位图。希望对您有所帮助。 快乐编码...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.