我对Android编程非常陌生,并且有一个我一直在组合的小应用程序。当用户触摸特定按钮时,它只是一个关于主题的简单幻灯片视图。除了运行Android 4.2.2 API 17的华为G716-L070之外,所有功能都非常有效。该应用程序已经设置为使用SDK 14的min。
当按下第一个按钮时,以下是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.access$600(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)
屏幕上显示一条消息,说应用正在关闭,但实际上只是关闭活动并返回菜单选项。
如果在此之后按下相同的按钮并且在按下任何其他按钮之前,则以下是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
所有其他手机和平板电脑的工作方式与预期一样,这款华为手机,华为手机的其他新款手机运行良好,只是因为这款手机较旧,无法运行。
答案 0 :(得分:0)
您可以在largeHeap
AndroidManifest.xml
<application
android:label="@string/app_name"
android:largeHeap="true" >