私はAndroidの世界で初めてです。私は単一のアクティビティでゲームを作成しました。このゲームはグリッドビューを使用し、その中で私はループ内に(〜150)個のイメージビューを動的に追加しています。 このゲームはデバイスで正常に動作していますが、エミュレータ(1GB RAM API:21)で実行しているときに、log catに以下のエラーが表示されます。私はこのログを多く理解することができませんが、それは私にメモリ関連のいくつかの問題を抱えています。アンドロイドエミュレータのランタイムエラーですが、デバイスにはありません
私はそれを理解するのを助けてください、そして、私はそれを解決するために何をすべきですか?
04-15 10:07:11.456 1985-1985/com.sbt.rahul.fiveinaline E/libprocessgroup: failed to make and chown /acct/uid_10053: Read-only file system
04-15 10:07:11.457 1985-1985/com.sbt.rahul.fiveinaline W/Zygote: createProcessGroup failed, kernel missing CONFIG_CGROUP_CPUACCT?
04-15 10:07:11.458 1985-1985/com.sbt.rahul.fiveinaline I/art: Not late-enabling -Xcheck:jni (already on)
04-15 10:07:14.828 1985-1987/com.sbt.rahul.fiveinaline W/art: Suspending all threads took: 52.563ms
04-15 10:07:14.916 1985-1985/com.sbt.rahul.fiveinaline E/MediaPlayer: Should have subtitle controller already set
04-15 10:07:14.973 1985-1985/com.sbt.rahul.fiveinaline E/MediaPlayer: Should have subtitle controller already set
04-15 10:07:19.016 1985-1987/com.sbt.rahul.fiveinaline W/art: Suspending all threads took: 103.229ms
04-15 10:07:19.742 1985-1997/com.sbt.rahul.fiveinaline I/art: Background sticky concurrent mark sweep GC freed 4477(352KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 49MB/49MB, paused 2.287ms total 120.294ms
04-15 10:07:20.013 1985-1997/com.sbt.rahul.fiveinaline I/art: Background partial concurrent mark sweep GC freed 78(16KB) AllocSpace objects, 0(0B) LOS objects, 7% free, 49MB/53MB, paused 2.899ms total 104.233ms
04-15 10:07:23.302 1985-1997/com.sbt.rahul.fiveinaline I/art: Background sticky concurrent mark sweep GC freed 79(3KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 58MB/58MB, paused 3.682ms total 162.287ms
04-15 10:07:23.558 1985-1997/com.sbt.rahul.fiveinaline I/art: Clamp target GC heap from 64MB to 64MB
04-15 10:07:23.558 1985-1997/com.sbt.rahul.fiveinaline I/art: Background partial concurrent mark sweep GC freed 29(3KB) AllocSpace objects, 0(0B) LOS objects, 4% free, 60MB/64MB, paused 2.929ms total 186.989ms
04-15 10:07:23.726 1985-1985/com.sbt.rahul.fiveinaline I/art: WaitForGcToComplete blocked for 32.919ms for cause Alloc
04-15 10:07:23.886 1985-1985/com.sbt.rahul.fiveinaline W/art: Suspending all threads took: 151.717ms
04-15 10:07:23.951 1985-1985/com.sbt.rahul.fiveinaline I/art: Alloc sticky concurrent mark sweep GC freed 14(448B) AllocSpace objects, 0(0B) LOS objects, 1% free, 63MB/64MB, paused 154.484ms total 223.649ms
04-15 10:07:24.059 1985-1987/com.sbt.rahul.fiveinaline W/art: Suspending all threads took: 31.104ms
04-15 10:07:24.188 1985-1985/com.sbt.rahul.fiveinaline I/art: Clamp target GC heap from 67MB to 64MB
04-15 10:07:24.189 1985-1985/com.sbt.rahul.fiveinaline I/art: Alloc partial concurrent mark sweep GC freed 24(1056B) AllocSpace objects, 0(0B) LOS objects, 1% free, 63MB/64MB, paused 4.194ms total 228.997ms
04-15 10:07:24.349 1985-1985/com.sbt.rahul.fiveinaline I/art: Clamp target GC heap from 67MB to 64MB
04-15 10:07:24.349 1985-1985/com.sbt.rahul.fiveinaline I/art: Alloc concurrent mark sweep GC freed 14(12KB) AllocSpace objects, 0(0B) LOS objects, 1% free, 63MB/64MB, paused 2.748ms total 154.201ms
04-15 10:07:24.358 1985-1985/com.sbt.rahul.fiveinaline I/art: Forcing collection of SoftReferences for 2MB allocation
04-15 10:07:24.500 1985-1985/com.sbt.rahul.fiveinaline I/art: Clamp target GC heap from 67MB to 64MB
04-15 10:07:24.500 1985-1985/com.sbt.rahul.fiveinaline I/art: Alloc concurrent mark sweep GC freed 11(344B) AllocSpace objects, 0(0B) LOS objects, 1% free, 63MB/64MB, paused 93.356ms total 141.245ms
04-15 10:07:24.506 1985-1985/com.sbt.rahul.fiveinaline E/art: Throwing OutOfMemoryError "Failed to allocate a 2250012 byte allocation with 995924 free bytes and 972KB until OOM"
04-15 10:07:24.507 1985-1985/com.sbt.rahul.fiveinaline D/skia: --- allocation failed for scaled bitmap
04-15 10:07:24.507 1985-1985/com.sbt.rahul.fiveinaline D/AndroidRuntime: Shutting down VM
--------- beginning of crash
04-15 10:07:24.524 1985-1985/com.sbt.rahul.fiveinaline E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.sbt.rahul.fiveinaline, PID: 1985
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.sbt.rahul.fiveinaline/com.sbt.rahul.fiveinaline.GameActivity}: android.view.InflateException: Binary XML file line #122: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: android.view.InflateException: Binary XML file line #122: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:633)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
at com.sbt.rahul.fiveinaline.GameActivity.onCreate(GameActivity.java:76)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
at com.sbt.rahul.fiveinaline.GameActivity.onCreate(GameActivity.java:76)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.OutOfMemoryError: Failed to allocate a 2250012 byte allocation with 995924 free bytes and 972KB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:973)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2423)
at android.content.res.Resources.loadDrawable(Resources.java:2330)
at android.content.res.TypedArray.getDrawable(TypedArray.java:749)
at android.view.View.<init>(View.java:3730)
at android.widget.ImageView.<init>(ImageView.java:139)
at android.widget.ImageButton.<init>(ImageButton.java:86)
at android.widget.ImageButton.<init>(ImageButton.java:82)
at android.widget.ImageButton.<init>(ImageButton.java:78)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:55)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:682)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:741)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:809)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
at android.app.Activity.setContentView(Activity.java:2144)
at com.sbt.rahul.fiveinaline.GameActivity.onCreate(GameActivity.java:76)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
04-15 10:07:33.382 1985-1996/com.sbt.rahul.fiveinaline I/art: Clamp target GC heap from 65MB to 64MB
読み込みログをご覧ください。あなたの問題は、XMLファイル内で発生しているようです。あるいは、 'GameActivity.java'の' 76'行で、レイアウトXMLが適用されている行のようです。 – xdevs23
これは、仮想デバイスではなく実際のデバイスに同じコードを実行しているときにうまくいきます。なぜこれが起こるのでしょうか? –
エミュレータのアンドロイド版が一部の値をサポートしていない可能性があります – xdevs23