我的应用程序没有在Genymotion上运行,我没有内存错误

时间:2016-04-30 13:04:40

标签: java android

我正在Android Studio中开发应用程序,但我无法在Genymotion虚拟机中运行该应用程序。 这里我是完整的日志,我被要求添加

android:largeHeap="true"

到AndroidManifest.xml但它仍然无法正常工作。 Splash屏幕活动打开,但下一个活动无法打开。 该应用程序运行一次,但当我再次运行它时,它一直给我以下错误消息。 我不善于分析日志,请帮我分析一下。

04-30 08:38:40.494   W/dalvikvm: VFY: unable to find class referenced in signature (Landroid/view/SearchEvent;)
04-30 08:38:40.494   I/dalvikvm: Could not find method android.view.Window$Callback.onSearchRequested, referenced from method android.support.v7.view.WindowCallbackWrapper.onSearchRequested
04-30 08:38:40.494   W/dalvikvm: VFY: unable to resolve interface method 15286: Landroid/view/Window$Callback;.onSearchRequested (Landroid/view/SearchEvent;)Z
04-30 08:38:40.494   D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
04-30 08:38:40.494   I/dalvikvm: Could not find method android.view.Window$Callback.onWindowStartingActionMode, referenced from method android.support.v7.view.WindowCallbackWrapper.onWindowStartingActionMode
04-30 08:38:40.494   W/dalvikvm: VFY: unable to resolve interface method 15290: Landroid/view/Window$Callback;.onWindowStartingActionMode (Landroid/view/ActionMode$Callback;I)Landroid/view/ActionMode;
04-30 08:38:40.494   D/dalvikvm: VFY: replacing opcode 0x72 at 0x0002
04-30 08:38:40.790   D/dalvikvm: GC_FOR_ALLOC freed 107K, 6% free 2925K/3088K, paused 4ms, total 4ms
04-30 08:38:41.498   I/dalvikvm-heap: Grow heap (frag case) to 104.245MB for 106260492-byte allocation
04-30 08:38:41.502   D/dalvikvm: GC_FOR_ALLOC freed <1K, 1% free 106695K/106860K, paused 5ms, total 5ms
04-30 08:38:42.346   I/dalvikvm: Could not find method android.content.res.TypedArray.getChangingConfigurations, referenced from method android.support.v7.widget.TintTypedArray.getChangingConfigurations
04-30 08:38:42.346   W/dalvikvm: VFY: unable to resolve virtual method 400: Landroid/content/res/TypedArray;.getChangingConfigurations ()I
04-30 08:38:42.346   D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
04-30 08:38:42.346   I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
04-30 08:38:42.346   W/dalvikvm: VFY: unable to resolve virtual method 422: Landroid/content/res/TypedArray;.getType (I)I
04-30 08:38:42.350   D/dalvikvm: VFY: replacing opcode 0x6e at 0x0002
04-30 08:38:42.514   D/dalvikvm: GC_FOR_ALLOC freed 5K, 1% free 106699K/106860K, paused 2ms, total 2ms
04-30 08:38:42.542   I/dalvikvm-heap: Grow heap (frag case) to 128.575MB for 25507724-byte allocation
04-30 08:38:42.550   D/dalvikvm: GC_FOR_ALLOC freed <1K, 1% free 131609K/131772K, paused 5ms, total 5ms
04-30 08:38:42.854   D/libEGL: loaded /system/lib/egl/libEGL_genymotion.so
04-30 08:38:42.902   D/libEGL: loaded /system/lib/egl/libGLESv1_CM_genymotion.so
04-30 08:38:42.902   D/libEGL: loaded /system/lib/egl/libGLESv2_genymotion.so
04-30 08:38:42.954   W/EGL_genymotion: eglSurfaceAttrib not implemented
04-30 08:38:42.954   E/OpenGLRenderer: Getting MAX_TEXTURE_SIZE from GradienCache
04-30 08:38:42.954   E/OpenGLRenderer: MAX_TEXTURE_SIZE: 8192
04-30 08:38:42.962   E/OpenGLRenderer: Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
04-30 08:38:42.962   E/OpenGLRenderer: MAX_TEXTURE_SIZE: 8192
04-30 08:38:42.962   D/OpenGLRenderer: Enabling debug mode 0
04-30 08:38:46.786   I/Choreographer: Skipped 227 frames!  The application may be doing too much work on its main thread.
04-30 08:38:50.870   I/Choreographer: Skipped 235 frames!  The application may be doing too much work on its main thread.
04-30 08:38:54.570   I/Choreographer: Skipped 221 frames!  The application may be doing too much work on its main thread.
04-30 08:38:58.934   D/dalvikvm: GC_FOR_ALLOC freed 17K, 1% free 132718K/132832K, paused 6ms, total 6ms
04-30 08:38:59.426   I/dalvikvm-heap: Grow heap (frag case) to 230.995MB for 106260492-byte allocation
04-30 08:38:59.438   D/dalvikvm: GC_FOR_ALLOC freed 1K, 1% free 236487K/236604K, paused 12ms, total 12ms
04-30 08:39:00.482   D/dalvikvm: GC_FOR_ALLOC freed 2K, 1% free 236497K/236604K, paused 4ms, total 4ms
04-30 08:39:00.490   I/dalvikvm-heap: Grow heap (frag case) to 242.040MB for 11571852-byte allocation
04-30 08:39:00.582   D/dalvikvm: GC_FOR_ALLOC freed <1K, 1% free 247797K/247908K, paused 11ms, total 11ms
04-30 08:39:00.746   I/dalvikvm-heap: Clamp target GC heap from 256.718MB to 256.000MB
04-30 08:39:00.746   D/dalvikvm: GC_FOR_ALLOC freed 12K, 1% free 254637K/254740K, paused 9ms, total 9ms
04-30 08:39:00.906   I/dalvikvm-heap: Clamp target GC heap from 263.388MB to 256.000MB
04-30 08:39:00.906   D/dalvikvm: GC_FOR_ALLOC freed <1K, 1% free 261467K/261572K, paused 9ms, total 10ms
04-30 08:39:00.906   I/dalvikvm-heap: Forcing collection of SoftReferences for 3494412-byte allocation
04-30 08:39:00.930   I/dalvikvm-heap: Clamp target GC heap from 263.380MB to 256.000MB
04-30 08:39:00.930   D/dalvikvm: GC_BEFORE_OOM freed 9K, 1% free 261457K/261572K, paused 25ms, total 25ms
04-30 08:39:00.930   E/dalvikvm-heap: Out of memory on a 3494412-byte allocation.
04-30 08:39:00.930   I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
04-30 08:39:00.938   I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0xa4d70bd8 self=0xb7d83eb0
04-30 08:39:00.938   I/dalvikvm:   | sysTid=1325 nice=0 sched=0/0 cgrp=apps handle=-1216466880
04-30 08:39:00.938   I/dalvikvm:   | state=R schedstat=( 4007499438 1841432816 4929 ) utm=274 stm=125 core=0
04-30 08:39:00.938   I/dalvikvm:     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
04-30 08:39:00.986   I/dalvikvm:     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:594)
04-30 08:39:00.986   I/dalvikvm:     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:429)
04-30 08:39:00.998   I/dalvikvm:     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
04-30 08:39:00.998   I/dalvikvm:     at android.content.res.Resources.loadDrawable(Resources.java:2110)
04-30 08:39:00.998   I/dalvikvm:     at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
04-30 08:39:00.998   I/dalvikvm:     at android.view.View.<init>(View.java:3554)
04-30 08:39:01.026   I/dalvikvm:     at android.widget.ImageView.<init>(ImageView.java:123)
04-30 08:39:01.046   I/dalvikvm:     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
04-30 08:39:01.046   I/dalvikvm:     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
04-30 08:39:01.046   I/dalvikvm:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
04-30 08:39:01.046   I/dalvikvm:     at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963)
04-30 08:39:01.046   I/dalvikvm:     at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022)
04-30 08:39:01.046   I/dalvikvm:     at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
04-30 08:39:01.050   I/dalvikvm:     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
04-30 08:39:01.054   I/dalvikvm:     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
04-30 08:39:01.054   I/dalvikvm:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
04-30 08:39:01.054   I/dalvikvm:     at as_for_john.dplan._Activity_Main.onCreate(_Activity_Main.java:15)
04-30 08:39:01.054   I/dalvikvm:     at android.app.Activity.performCreate(Activity.java:5231)
04-30 08:39:01.054   I/dalvikvm:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
04-30 08:39:01.054   I/dalvikvm:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
04-30 08:39:01.054   I/dalvikvm:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
04-30 08:39:01.054   I/dalvikvm:     at android.app.ActivityThread.access$800(ActivityThread.java:135)
04-30 08:39:01.054   I/dalvikvm:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
04-30 08:39:01.054   I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:102)
04-30 08:39:01.058   I/dalvikvm:     at android.os.Looper.loop(Looper.java:136)
04-30 08:39:01.058   I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:5001)
04-30 08:39:01.058   I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
04-30 08:39:01.058   I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:515)
04-30 08:39:01.058   I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
04-30 08:39:01.058   I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
04-30 08:39:01.058   I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
04-30 08:39:01.058   D/skia: --- allocation failed for scaled bitmap
04-30 08:39:01.058   D/AndroidRuntime: Shutting down VM
04-30 08:39:01.058   W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4d6fb20)
04-30 08:39:01.058   E/AndroidRuntime: FATAL EXCEPTION: main
                                                                 Process: as_for_john.dplan, PID: 1325
                                                                 java.lang.OutOfMemoryError
                                                                     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
                                                                     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:594)
                                                                     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:429)
                                                                     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
                                                                     at android.content.res.Resources.loadDrawable(Resources.java:2110)
                                                                     at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
                                                                     at android.view.View.<init>(View.java:3554)
                                                                     at android.widget.ImageView.<init>(ImageView.java:123)
                                                                     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:57)
                                                                     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:53)
                                                                     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
                                                                     at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963)
                                                                     at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022)
                                                                     at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44)
                                                                     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:684)
                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                     at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
                                                                     at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
                                                                     at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)
                                                                     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)
                                                                     at as_for_john.dplan._Activity_Main.onCreate(_Activity_Main.java:15)
                                                                     at android.app.Activity.performCreate(Activity.java:5231)
                                                                     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
                                                                     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
                                                                     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
                                                                     at android.app.ActivityThread.access$800(ActivityThread.java:135)
                                                                     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
                                                                     at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                     at android.os.Looper.loop(Looper.java:136)
                                                                     at android.app.ActivityThread.main(ActivityThread.java:5001)
                                                                     at java.lang.reflect.Method.invokeNative(Native Method)
                                                                     at java.lang.reflect.Method.invoke(Method.java:515)
                                                                     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
                                                                     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
                                                                     at dalvik.system.NativeStart.main(Native Method)

2 个答案:

答案 0 :(得分:0)

您收到此错误,因为您的第二个活动包含更大的图片。

将第二个活动的背景图像更改为某个低分辨率图像,它可以正常工作。

答案 1 :(得分:0)

你可以做点什么,

BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 2;

Bitmap bm = BitmapFactory.decodeResource(getActivity().getResources(),
            R.drawable.icon, options);

    imgView.setImageBitmap(bm);

你可以改变

  

inSampleSize

根据您的要求。

检查结果..