我的问题发生在一个活动(我的情况下的登录活动 - 你可以猜测代码都是基本的)从启动画面(使用)线程调用。
当我避开启动并直接从启动器调用登录活动时,它工作正常,但当我尝试放置它的前面时它会返回此错误。
android.view.InflateException:二进制XML文件行#8:二进制XML文件行#2:错误导致类
Bu在Lollipop设备上正常工作,当我使用Marshmallow Emulator进行测试时,会发生错误。有人有什么想法吗?
更多详情:
我在类中使用AppCompatActivity,这是清单部分
</activity>
<activity
android:name=".SplashActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".LoginActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar" >
</activity>
错误:无法启动活动ComponentInfo {com.dev.jashan.myapplication / com.dev.jashan.myapplication.LoginActivity}:android.view.InflateException:二进制XML文件行#8:二进制XML文件行#2:膨胀类错误
完整筹码
12-05 00:23:01.349 11694-11694/com.dev.jashan.myapplication I/art: Not late-enabling -Xcheck:jni (already on)
12-05 00:23:01.349 11694-11694/com.dev.jashan.myapplication I/art: Late-enabling JIT
12-05 00:23:01.356 11694-11694/com.dev.jashan.myapplication I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000
12-05 00:23:01.397 11694-11694/com.dev.jashan.myapplication W/System: ClassLoader referenced unknown path: /data/app/com.dev.jashan.myapplication-1/lib/x86
12-05 00:23:01.436 11694-11709/com.dev.jashan.myapplication I/GMPM: App measurement is starting up
12-05 00:23:01.439 11694-11709/com.dev.jashan.myapplication E/GMPM: getGoogleAppId failed with status: 10
12-05 00:23:01.439 11694-11709/com.dev.jashan.myapplication E/GMPM: Uploading is not possible. App measurement disabled
12-05 00:23:01.598 11694-11705/com.dev.jashan.myapplication I/art: Background sticky concurrent mark sweep GC freed 8757(552KB) AllocSpace objects, 4(80KB) LOS objects, 0% free, 32MB/32MB, paused 19.333ms total 49.138ms
12-05 00:23:01.659 11694-11725/com.dev.jashan.myapplication D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
12-05 00:23:01.666 11694-11694/com.dev.jashan.myapplication D/: HostConnection::get() New Host Connection established 0xabfbd760, tid 11694
12-05 00:23:01.701 11694-11725/com.dev.jashan.myapplication I/OpenGLRenderer: Initialized EGL, version 1.4
12-05 00:23:01.822 11694-11725/com.dev.jashan.myapplication W/EGL_emulation: eglSurfaceAttrib not implemented
12-05 00:23:01.822 11694-11725/com.dev.jashan.myapplication W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xad7e0300, error=EGL_SUCCESS
12-05 00:23:04.697 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.699 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.709 11694-11694/com.dev.jashan.myapplication I/art: Alloc sticky concurrent mark sweep GC freed 374(79KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 33MB/36MB, paused 973us total 7.599ms
12-05 00:23:04.712 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.720 11694-11694/com.dev.jashan.myapplication I/art: Alloc partial concurrent mark sweep GC freed 130(11KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 955us total 7.013ms
12-05 00:23:04.722 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.729 11694-11694/com.dev.jashan.myapplication I/art: Alloc concurrent mark sweep GC freed 20(12KB) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 935us total 6.393ms
12-05 00:23:04.731 11694-11694/com.dev.jashan.myapplication I/art: Forcing collection of SoftReferences for 31MB allocation
12-05 00:23:04.731 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.738 11694-11694/com.dev.jashan.myapplication I/art: Alloc concurrent mark sweep GC freed 0(0B) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 1.111ms total 6.810ms
12-05 00:23:04.738 11694-11694/com.dev.jashan.myapplication W/art: Throwing OutOfMemoryError "Failed to allocate a 33177612 byte allocation with 4194304 free bytes and 30MB until OOM"
12-05 00:23:04.738 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.739 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.749 11694-11694/com.dev.jashan.myapplication I/art: Alloc sticky concurrent mark sweep GC freed 3(576B) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 994us total 9.553ms
12-05 00:23:04.750 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.757 11694-11694/com.dev.jashan.myapplication I/art: Alloc partial concurrent mark sweep GC freed 32(1320B) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 945us total 6.256ms
12-05 00:23:04.757 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.767 11694-11694/com.dev.jashan.myapplication I/art: Alloc concurrent mark sweep GC freed 5(128B) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 1.007ms total 9.957ms
12-05 00:23:04.769 11694-11694/com.dev.jashan.myapplication I/art: Forcing collection of SoftReferences for 31MB allocation
12-05 00:23:04.769 11694-11694/com.dev.jashan.myapplication I/art: Starting a blocking GC Alloc
12-05 00:23:04.778 11694-11694/com.dev.jashan.myapplication I/art: Alloc concurrent mark sweep GC freed 3(96B) AllocSpace objects, 0(0B) LOS objects, 10% free, 33MB/37MB, paused 937us total 8.345ms
12-05 00:23:04.781 11694-11694/com.dev.jashan.myapplication W/art: Throwing OutOfMemoryError "Failed to allocate a 33177612 byte allocation with 4194304 free bytes and 30MB until OOM"
12-05 00:23:04.781 11694-11694/com.dev.jashan.myapplication D/skia: --- allocation failed for scaled bitmap
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication D/AndroidRuntime: Shutting down VM
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: FATAL EXCEPTION: main
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: Process: com.dev.jashan.myapplication, PID: 11694
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dev.jashan.myapplication/com.dev.jashan.myapplication.LoginActivity}: android.view.InflateException: Binary XML file line #8: Binary XML file line #2: Error inflating class <unknown>
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #8: Binary XML file line #2: Error inflating class <unknown>
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:257)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.dev.jashan.myapplication.LoginActivity.onCreate(LoginActivity.java:49)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6237)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:645)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:941)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:257)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.dev.jashan.myapplication.LoginActivity.onCreate(LoginActivity.java:49)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6237)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Constructor.newInstance(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:619)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:941)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:257)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.dev.jashan.myapplication.LoginActivity.onCreate(LoginActivity.java:49)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6237)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: Caused by: java.lang.OutOfMemoryError: Failed to allocate a 33177612 byte allocation with 4194304 free bytes and 30MB until OOM
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:1080)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.content.res.Resources.loadDrawableForCookie(Resources.java:2635)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.content.res.Resources.loadDrawable(Resources.java:2540)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.content.res.TypedArray.getDrawable(TypedArray.java:870)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.View.<init>(View.java:3948)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.ViewGroup.<init>(ViewGroup.java:573)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.widget.LinearLayout.<init>(LinearLayout.java:203)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.widget.LinearLayout.<init>(LinearLayout.java:199)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.widget.LinearLayout.<init>(LinearLayout.java:195)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Constructor.newInstance(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.createView(LayoutInflater.java:619)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.onCreateView(LayoutInflater.java:694)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:762)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:941)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.parseInclude(LayoutInflater.java:971)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflate(LayoutInflater.java:831)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:257)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.dev.jashan.myapplication.LoginActivity.onCreate(LoginActivity.java:49)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6237)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.-wrap11(ActivityThread.java)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
12-05 00:23:04.782 11694-11694/com.dev.jashan.myapplication E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
答案 0 :(得分:2)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 33177612 byte allocation with 4194304 free bytes and 30MB until OOM
在某个地方,您有一个LinearLayout
,可能是一个android:background
属性。该背景的解码资源为33,177,612字节。这太大了。一个完整的1080p图像只有8MB,而不是~32MB。
通常,这是由于首先拥有太大的图像并将其置于错误的资源目录(例如res/drawable/
)中而引起的。
您将需要识别此LinearLayout
,识别导致崩溃的图像,然后做一些不尝试分配这么多内存的事情,例如:
res/drawable-mdpi/
,res/drawable-hdpi/
),以便Android不需要尝试重新采样图像以修复密度res/drawable-nodpi/
中,因此Android无需尝试重新取样