仅华为(Android)phone失败

Only Huawei(Android) phone fails

我对 Android 编程还很陌生,并且有一个我一直在组装的小应用程序。当用户触摸特定按钮时,它只是一个关于主题的简单幻灯片视图。除了 Huawei G716-L070 运行ning Android 4.2.2 API 17 之外,所有功能都按预期运行良好。该应用程序已设置为使用 SDK 14 的最小值。

按下第一个按钮时,以下是 Logcat 输出:-

 I/dalvikvm-heap: Grow heap (frag case) to 32.714MB for 1920016-byte allocation  I/dalvikvm-heap: Grow heap (frag case) to 40.030MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 47.355MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 54.680MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 62.005MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 69.332MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 76.657MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 83.982MB for 7680016-byte allocation
 W/GooglePlayServicesUtil: Google Play Store is missing.
 W/GooglePlayServicesUtil: Google Play Store is missing.
 I/Ads: Starting ad request.
 I/Ads: Use AdRequest.Builder.addTestDevice("430EEBDFC6516F3DB989DBE19B86198E") to get test ads on this device.
 W/GooglePlayServicesUtil: Google Play Store is missing.
 W/GooglePlayServicesUtil: Google Play Store is missing.
 I/Choreographer: Skipped 56 frames!  The application may be doing too much work on its main thread.
 W/GooglePlayServicesUtil: Google Play services is missing.
 I/Ads: Scheduling ad refresh 70000 milliseconds from now.
 I/Ads: Ad finished loading.

然后,如果按下另一个按钮:-

 I/dalvikvm-heap: Grow heap (frag case) to 91.760MB for 7680016-byte allocation
 I/dalvikvm-heap: Clamp target GC heap from 97.751MB to 96.000MB
 I/dalvikvm-heap: Forcing collection of SoftReferences for 7680016-byte allocation
 I/dalvikvm-heap: Clamp target GC heap from 97.744MB to 96.000MB
 E/dalvikvm-heap: Out of memory on a 7680016-byte allocation.
 I/dalvikvm: "main" prio=5 tid=1 RUNNABLE
 I/dalvikvm:   | group="main" sCount=0 dsCount=0 obj=0x40cccb38 self=0x40c982b8
 I/dalvikvm:   | sysTid=7021 nice=0 sched=0/0 cgrp=apps handle=1074789596
 I/dalvikvm:   | state=R schedstat=( 0 0 0 ) utm=11547 stm=958 core=0
 I/dalvikvm:     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
 I/dalvikvm:     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:502)
 I/dalvikvm:     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:355)
 I/dalvikvm:     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:785)
 I/dalvikvm:     at android.content.res.Resources.loadDrawable(Resources.java:1965)
 I/dalvikvm:     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
 I/dalvikvm:     at android.widget.ImageView.<init>(ImageView.java:120)
 I/dalvikvm:     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:72)
 I/dalvikvm:     at android.support.v7.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
 I/dalvikvm:     at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:106)
 I/dalvikvm:     at android.support.v7.app.AppCompatDelegateImplV9.createView(AppCompatDelegateImplV9.java:1024)
 I/dalvikvm:     at android.support.v7.app.AppCompatDelegateImplV9.onCreateView(AppCompatDelegateImplV9.java:1081)
 I/dalvikvm:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:675)
 I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
 I/dalvikvm:     at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
 I/dalvikvm:     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
 I/dalvikvm:     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
 I/dalvikvm:     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
 I/dalvikvm:     at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:287)
 I/dalvikvm:     at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:139)
 I/dalvikvm:     at com.qualassur.learnenglish.Abc_hn_Activity.onCreate(Abc_hn_Activity.java:24)
 I/dalvikvm:     at android.app.Activity.performCreate(Activity.java:5104)
 I/dalvikvm:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
 I/dalvikvm:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2147)
 I/dalvikvm:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
 I/dalvikvm:     at android.app.ActivityThread.access0(ActivityThread.java:144)
 I/dalvikvm:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
 I/dalvikvm:     at android.os.Handler.dispatchMessage(Handler.java:99)
 I/dalvikvm:     at android.os.Looper.loop(Looper.java:137)
 I/dalvikvm:     at android.app.ActivityThread.main(ActivityThread.java:5074)
 I/dalvikvm:     at java.lang.reflect.Method.invokeNative(Native Method)
 I/dalvikvm:     at java.lang.reflect.Method.invoke(Method.java:511)
 I/dalvikvm:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
 I/dalvikvm:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
 I/dalvikvm:     at dalvik.system.NativeStart.main(Native Method)
 W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40ccbac8)

屏幕上有一条消息说应用程序正在关闭,但实际上只是关闭了 activity 和 returns 菜单选项。

如果在此之后和按下任何其他按钮之前按下同一个按钮,则以下是 logcat 输出和所有工作。

 I/dalvikvm-heap: Grow heap (frag case) to 38.795MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 46.109MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 53.435MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 60.760MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 68.085MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 75.411MB for 7680016-byte allocation
 I/dalvikvm-heap: Grow heap (frag case) to 82.737MB for 7680016-byte allocation
 W/GooglePlayServicesUtil: Google Play Store is missing.
 W/GooglePlayServicesUtil: Google Play Store is missing.
 I/Ads: Starting ad request.
 I/Ads: Use AdRequest.Builder.addTestDevice("430EEBDFC6516F3DB989DBE19B86198E") to get test ads on this device.
 W/GooglePlayServicesUtil: Google Play Store is missing.
 W/GooglePlayServicesUtil: Google Play Store is missing.
 I/Choreographer: Skipped 39 frames!  The application may be doing too much work on its main thread.
 W/GooglePlayServicesUtil: Google Play services is missing.
 I/Ads: Scheduling ad refresh 70000 milliseconds from now.
 I/Ads: Ad finished loading.
 W/Ads: JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/viewabilityChanged?hashCode=7516e93f-f26b-4f58-b16d-a43729a40b35&clickString=BBdBVbOTWWuWvKoTb2AT6mqioBADG04v_mQcAABABOAHIAQnIA4oEiAXH2LXzAqAGLtIIBQiAYRAB&isVisible=1&google.afma.Notify_dt=1524032621711.
                                                                (null:1)
 W/Web Console: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/viewabilityChanged?hashCode=7516e93f-f26b-4f58-b16d-a43729a40b35&clickString=BBdBVbOTWWuWvKoTb2AT6mqioBADG04v_mQcAABABOAHIAQnIA4oEiAXH2LXzAqAGLtIIBQiAYRAB&isVisible=1&google.afma.Notify_dt=1524032621711.
                                                                        at null:1
 W/Ads: JS: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/viewabilityChanged?hashCode=7516e93f-f26b-4f58-b16d-a43729a40b35&clickString=BBdBVbOTWWuWvKoTb2AT6mqioBADG04v_mQcAABABOAHIAQnIA4oEiAXH2LXzAqAGLtIIBQiAYRAB&isVisible=1&google.afma.Notify_dt=1524032621711.
                                                                (null:1)
 W/Web Console: The page at about:blank displayed insecure content from gmsg://mobileads.google.com/viewabilityChanged?hashCode=7516e93f-f26b-4f58-b16d-a43729a40b35&clickString=BBdBVbOTWWuWvKoTb2AT6mqioBADG04v_mQcAABABOAHIAQnIA4oEiAXH2LXzAqAGLtIIBQiAYRAB&isVisible=1&google.afma.Notify_dt=1524032621711.
                                                                        at null:1
 W/Ads: JS: The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
                                                                (null:1)
 W/Web Console: The page at https://googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.html displayed insecure content from file:///android_asset/webkit/android-weberror.png.
                                                                        at null:1

所有其他 phones 和平板电脑都可以正常工作,只有这一个华为 phone,其他较新的华为 phone 型号工作正常,只是这个 phone 年龄较大,因此无法 运行。

您可以在AndroidManifest.xml

中设置largeHeap
<application        
        android:label="@string/app_name"
        android:largeHeap="true" >