【问题标题】:App not working in avd应用程序无法在 avd 中运行
【发布时间】:2015-11-20 16:06:45
【问题描述】:

如果你忍不住不要投反对票..请给其他机会.....而且这个不是重复的我尝试了之前给出的所有解决方案

默认的 activity_main.xml 不起作用。所以我创建了另一个作为删除前一个。但是现在当我启动 Avd 时,它(应用程序)以 msg 关闭:“不幸的是应用程序停止工作”。

图形布局中的一切似乎都很好......我认为它只是 AVD

记录猫:

11-20 22:07:17.326 2381-2381/? I/art: Not late-enabling -Xcheck:jni (already on)
11-20 22:07:18.198 2381-2384/com.example.abhinav.vendue W/art: Suspending all threads took: 5.062ms
11-20 22:07:19.330 2381-2381/com.example.abhinav.vendue I/art: WaitForGcToComplete blocked for 9.928ms for cause Alloc
11-20 22:07:19.378 2381-2381/com.example.abhinav.vendue I/art: Alloc sticky concurrent mark sweep GC freed 2821(231KB) AllocSpace objects, 0(0B) LOS objects, 39% free, 679KB/1117KB, paused 4.957ms total 39.087ms
11-20 22:07:19.418 2381-2381/com.example.abhinav.vendue I/art: Alloc partial concurrent mark sweep GC freed 163(19KB) AllocSpace objects, 0(0B) LOS objects, 60% free, 659KB/1683KB, paused 4.529ms total 35.334ms
11-20 22:07:19.425 2381-2381/com.example.abhinav.vendue W/art: Suspending all threads took: 6.134ms
11-20 22:07:19.486 2381-2381/com.example.abhinav.vendue I/art: Alloc concurrent mark sweep GC freed 15(12KB) AllocSpace objects, 0(0B) LOS objects, 61% free, 647KB/1671KB, paused 3.219ms total 51.322ms
11-20 22:07:19.488 2381-2381/com.example.abhinav.vendue I/art: Forcing collection of SoftReferences for 97MB allocation
11-20 22:07:19.637 2381-2381/com.example.abhinav.vendue I/art: Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 61% free, 647KB/1671KB, paused 36.059ms total 116.237ms
11-20 22:07:19.648 2381-2381/com.example.abhinav.vendue E/art: Throwing OutOfMemoryError "Failed to allocate a 102400012 byte allocation with 1048576 free bytes and 63MB until OOM"
11-20 22:07:19.667 2381-2381/com.example.abhinav.vendue I/art: WaitForGcToComplete blocked for 18.213ms for cause Alloc
11-20 22:07:19.686 2381-2384/com.example.abhinav.vendue W/art: Suspending all threads took: 11.017ms
11-20 22:07:19.728 2381-2381/com.example.abhinav.vendue I/art: Alloc sticky concurrent mark sweep GC freed 5(608B) AllocSpace objects, 0(0B) LOS objects, 61% free, 647KB/1671KB, paused 4.534ms total 59.137ms
11-20 22:07:19.772 2381-2381/com.example.abhinav.vendue I/art: Alloc partial concurrent mark sweep GC freed 10(320B) AllocSpace objects, 0(0B) LOS objects, 61% free, 647KB/1671KB, paused 6.520ms total 39.893ms
11-20 22:07:19.822 2381-2381/com.example.abhinav.vendue I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 61% free, 647KB/1671KB, paused 7.644ms total 39.046ms
11-20 22:07:19.832 2381-2381/com.example.abhinav.vendue I/art: Forcing collection of SoftReferences for 97MB allocation
11-20 22:07:19.870 2381-2381/com.example.abhinav.vendue I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 61% free, 647KB/1671KB, paused 3.137ms total 35.320ms
11-20 22:07:19.876 2381-2381/com.example.abhinav.vendue E/art: Throwing OutOfMemoryError "Failed to allocate a 102400012 byte allocation with 1048576 free bytes and 63MB until OOM"
11-20 22:07:19.876 2381-2381/com.example.abhinav.vendue D/skia: --- allocation failed for scaled bitmap
11-20 22:07:19.883 2381-2381/com.example.abhinav.vendue D/AndroidRuntime: Shutting down VM
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime: FATAL EXCEPTION: main
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime: Process: com.example.abhinav.vendue, PID: 2381
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime: java.lang.OutOfMemoryError: Failed to allocate a 102400012 byte allocation with 1048576 free bytes and 63MB until OOM
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:988)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.content.res.Resources.loadDrawableForCookie(Resources.java:2474)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.content.res.Resources.loadDrawable(Resources.java:2381)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.view.View.<init>(View.java:3737)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.widget.TextView.<init>(TextView.java:637)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.widget.Button.<init>(Button.java:111)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.widget.Button.<init>(Button.java:107)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:63)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:59)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.internal.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:101)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:806)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:836)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:725)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at com.example.abhinav.vendue.MainActivity.onCreate(MainActivity.java:21)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:5990)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:151)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:135)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5257)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
11-20 22:07:19.885 2381-2381/com.example.abhinav.vendue E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
11-20 22:07:20.818 2381-2384/com.example.abhinav.vendue W/art: Suspending all threads took: 89.265ms
11-20 22:07:21.314 2381-2384/com.example.abhinav.vendue W/art: Suspending all threads took: 65.580ms
11-20 22:07:23.988 2381-2381/? I/Process: Sending signal. PID: 2381 SIG: 9

【问题讨论】:

  • 为什么停止了?帮帮我们,我们不是通灵者
  • 随您的问题提供堆栈跟踪日志。另见:stackoverflow.com/questions/23353173/…
  • @TimCastelijns 抱歉,我不知道您需要什么
  • @MorrisonChang 我已经上传了原木猫

标签: android android-studio


【解决方案1】:

OutOfMemoryError 是 android 中最常见的问题,尤其是在处理位图时。当由于内存空间不足而无法分配对象并且垃圾收集器无法释放一些空间时,Java 虚拟机 (JVM) 会引发此错误。

我认为你应该在 Android 的开发者页面上阅读一些内容,特别是这里:Displaying Bitmaps Efficiently

阅读所有 5 节课并再次重写您的代码。如果它仍然不起作用,我们将很高兴看到您在教程材料中做错了什么。

这里是 SOF 中此类错误的一些可能答案

Android: BitmapFactory.decodeStream() out of memory with a 400KB file with 2MB free heap

How to solve java.lang.OutOfMemoryError trouble in Android

Android : java.lang.OutOfMemoryError

java.lang.OutOfMemoryError

Solution for OutOfMemoryError: bitmap size exceeds VM budget

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-30
    • 2013-08-18
    • 1970-01-01
    • 2013-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多