Недостаточно места для показа рекламы.Требуется 360x50 дп, но только 360x0 дп - PullRequest
0 голосов
/ 26 мая 2018

Мое приложение вылетает во второй раз, когда я его открываю.и я получаю сообщение об ошибке «Недостаточно места для показа рекламы. Требуется 360x50 dp, но только 360x0 dp.».Ниже приведен макет, используемый для отображения рекламы. Моя первая деятельность не использует adview.Когда я выхожу из первого занятия и снова открываю приложение, оно работает нормально.Мое второе занятие также содержит рекламу и возможность выхода.Когда я выхожу из второго занятия (макет указан ниже) и снова открываю приложение, оно вылетает. Так как проблема возникает только при выходе из второго занятия.я подозреваю, что adview скрывается за сбоем, но я не уверен.

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.sunplus.suniq.activity.FresherActivity"
    tools:showIn="@layout/activity_fresher">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ListView
            android:id="@+id/simpleListView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:divider="@color/material_blue_grey_800"
            android:dividerHeight="1dp"
            android:footerDividersEnabled="false" />

        <com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            ads:adSize="BANNER"
            ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
        </com.google.android.gms.ads.AdView>

    </LinearLayout>

</android.support.constraint.ConstraintLayout>

Это то, что показывает logcat. (каким-то образом первоначальная ошибка изменилась в logcat, но проблема выполнения остается той же).При закрытии приложения и его открытии снова происходит сбой.

W/ResourceType: No package identifier when getting value for resource number 0x00000258
W/ImageView: Unable to find resource: 600
             android.content.res.Resources$NotFoundException: Resource ID #0x258
                 at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:224)
                 at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
                 at android.content.res.Resources.getDrawable(Resources.java:819)
                 at android.content.Context.getDrawable(Context.java:605)
                 at android.widget.ImageView.resolveUri(ImageView.java:915)
                 at android.widget.ImageView.setImageResource(ImageView.java:477)
                 at com.android.volley.toolbox.ImageLoader$1.onResponse(ImageLoader.java:112)
                 at com.android.volley.toolbox.ImageLoader.get(ImageLoader.java:229)
                 at com.android.volley.toolbox.ImageLoader.get(ImageLoader.java:191)
                 at com.android.volley.toolbox.ImageLoader.get(ImageLoader.java:182)
                 at com.sunplus.suniq.adapter.CustomAdapter.getView(CustomAdapter.java:80)
                 at android.widget.AbsListView.obtainView(AbsListView.java:2365)
                 at android.widget.ListView.measureHeightOfChildren(ListView.java:1408)
                 at android.widget.ListView.onMeasure(ListView.java:1315)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
                 at android.view.View.measure(View.java:22071)
                 at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1028)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:739)
                 at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:91)
                 at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1361)
                 at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:809)
                 at android.view.View.measure(View.java:22071)
                 at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1059)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                 at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                 at com.android.internal.policy.DecorView.onMeasure(DecorView.java:724)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2422)
                 at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1504)
                 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1761)
                 at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
                 at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
                 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
                 at android.view.Choreographer.doCallbacks(Choreographer.java:723)
                 at android.view.Choreographer.doFrame(Choreographer.java:658)
                 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
                 at android.os.Handler.handleCallback(Handler.java:790)
                 at android.os.Handler.dispatchMessage(Handler.java:99)
                 at android.os.Looper.loop(Looper.java:164)
                 at android.app.ActivityThread.main(ActivityThread.java:6494)
                 at java.lang.reflect.Method.invoke(Native Method)
                 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
W/ResourceType: No package identifier when getting value for resource number 0x00000258
W/ImageView: Unable to find resource: 600
             android.content.res.Resources$NotFoundException: Resource ID #0x258
                 at android.content.res.ResourcesImpl.getValueForDensity(ResourcesImpl.java:224)
                 at android.content.res.Resources.getDrawableForDensity(Resources.java:876)
                 at android.content.res.Resources.getDrawable(Resources.java:819)
                 at android.content.Context.getDrawable(Context.java:605)
                 at android.widget.ImageView.resolveUri(ImageView.java:915)
                 at android.widget.ImageView.setImageResource(ImageView.java:477)
                 at com.android.volley.toolbox.ImageLoader$1.onResponse(ImageLoader.java:112)
                 at com.android.volley.toolbox.ImageLoader.get(ImageLoader.java:229)
                 at com.android.volley.toolbox.ImageLoader.get(ImageLoader.java:191)
                 at com.android.volley.toolbox.ImageLoader.get(ImageLoader.java:182)
                 at com.sunplus.suniq.adapter.CustomAdapter.getView(CustomAdapter.java:80)
                 at android.widget.AbsListView.obtainView(AbsListView.java:2365)
                 at android.widget.ListView.measureHeightOfChildren(ListView.java:1408)
                 at android.widget.ListView.onMeasure(ListView.java:1315)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
                 at android.view.View.measure(View.java:22071)
                 at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1028)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.support.design.widget.CoordinatorLayout.onMeasureChild(CoordinatorLayout.java:739)
                 at android.support.design.widget.HeaderScrollingViewBehavior.onMeasureChild(HeaderScrollingViewBehavior.java:91)
                 at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onMeasureChild(AppBarLayout.java:1361)
                 at android.support.design.widget.CoordinatorLayout.onMeasure(CoordinatorLayout.java:809)
                 at android.view.View.measure(View.java:22071)
                 at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:1059)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                 at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:141)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1514)
                 at android.widget.LinearLayout.measureVertical(LinearLayout.java:806)
                 at android.widget.LinearLayout.onMeasure(LinearLayout.java:685)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6602)
                 at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
                 at com.android.internal.policy.DecorView.onMeasure(DecorView.java:724)
                 at android.view.View.measure(View.java:22071)
                 at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2422)
                 at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1504)
                 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1761)
                 at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1392)
                 at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6752)
W/ImageView:     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
                 at android.view.Choreographer.doCallbacks(Choreographer.java:723)
                 at android.view.Choreographer.doFrame(Choreographer.java:658)
                 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
                 at android.os.Handler.handleCallback(Handler.java:790)
                 at android.os.Handler.dispatchMessage(Handler.java:99)
                 at android.os.Looper.loop(Looper.java:164)
                 at android.app.ActivityThread.main(ActivityThread.java:6494)
                 at java.lang.reflect.Method.invoke(Native Method)
                 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
                 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
I/Ads: Starting ad request.
I/Ads: This request is sent from a test device.
I/zygote: JIT allocated 67KB for compiled code of void android.view.View.<init>(android.content.Context, android.util.AttributeSet, int, int)
I/Choreographer: Skipped 33 frames!  The application may be doing too much work on its main thread.
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
I/Ads: Scheduling ad refresh 70000 milliseconds from now.
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:280
                  Selected remote version of com.google.android.gms.ads.dynamite, version >= 280
I/Ads: Ad finished loading.
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
I/zygote: Do full code cache collection, code=469KB, data=292KB
I/zygote: After code cache collection, code=389KB, data=233KB
          JIT allocated 56KB for compiled code of void android.view.View.<init>(android.content.Context, android.util.AttributeSet, int, int)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
W/zygote: Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
W/zygote: Attempt to remove non-JNI local reference, dumping thread
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
D/OpenGLRenderer: endAllActiveAnimators on 0xe6adc700 (MenuPopupWindow$MenuDropDownListView) with handle 0xd30ff080
D/EGL_emulation: eglMakeCurrent: 0xf00b21e0: ver 3 1 (tinfo 0xf008fa30)
I/Process: Sending signal. PID: 28712 SIG: 9
Application terminated.

Ответы [ 2 ]

0 голосов
/ 26 мая 2018
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:showIn="@layout/activity_fresher">

    <ListView
        android:id="@+id/simpleListView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/adView"
        android:divider="@color/material_blue_grey_800"
        android:dividerHeight="1dp"
        android:footerDividersEnabled="false" />


    <com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ads:adSize="BANNER"
        ads:adUnitId="ca-app-pub-3940256099942544/6300978111"></com.google.android.gms.ads.AdView>

</RelativeLayout>

Используйте это в макете, это полностью решит вашу проблему.

Надеюсь, что это работает

0 голосов
/ 26 мая 2018

Вам нужно придать вес списку, если вы хотите статический баннер внизу линейного макета.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ListView
            android:id="@+id/simpleListView"
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:divider="@color/material_blue_grey_800"
            android:dividerHeight="1dp"
            android:layout_weight="1" 
            android:footerDividersEnabled="false" />

        <com.google.android.gms.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_alignParentBottom="true"
            ads:adSize="BANNER"
            ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
        </com.google.android.gms.ads.AdView>

    </LinearLayout>

надеюсь, это поможет вам.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...