gpt4 book ai didi

android - AdMob 崩溃 "requestFeature() must be called before adding content"

转载 作者:行者123 更新时间:2023-11-29 19:30:04 25 4
gpt4 key购买 nike

首先,这不是我自己遇到的问题。点击测试广告在我的所有设备上都能正常工作。但是,我收到了一些用户(不使用 root 或 Xposed)的崩溃报告。

Exception java.lang.RuntimeException: Unable to start activity ComponentInfo{com.geecko.QuickLyric/com.google.android.gms.ads.AdActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2656)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2721)
android.app.ActivityThread.access$900 (ActivityThread.java:168)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1393)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5753)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1405)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1200)
arrow_drop_down
Caused by android.util.AndroidRuntimeException: requestFeature() must be called before adding content
com.android.internal.policy.impl.PhoneWindow.requestFeature (PhoneWindow.java:354)
android.app.Activity.requestWindowFeature (Activity.java:3762)
com.google.android.gms.ads.internal.overlay.k.a (:com.google.android.gms.DynamiteModulesA:284)
com.google.android.gms.ads.internal.overlay.client.c.onTransact (:com.google.android.gms.DynamiteModulesA:58)
android.os.Binder.transact (Binder.java:380)
com.google.android.gms.internal.zzhm$zza$zza.a ()
com.google.android.gms.ads.AdActivity.onCreate ()
android.app.Activity.performCreate (Activity.java:6112)
android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1117)
android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2609)
android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2721)
android.app.ActivityThread.access$900 (ActivityThread.java:168)
android.app.ActivityThread$H.handleMessage (ActivityThread.java:1393)
android.os.Handler.dispatchMessage (Handler.java:102)
android.os.Looper.loop (Looper.java:135)
android.app.ActivityThread.main (ActivityThread.java:5753)
java.lang.reflect.Method.invoke (Method.java)
java.lang.reflect.Method.invoke (Method.java:372)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1405)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1200)

AdActivity 声明了两次。一次在 aar list 中,一次在我的 list 中。

<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />

如您所见,堆栈跟踪中几乎没有我的包名称。此外,我显然不负责为 AdActivity 调用 requestFeature() 或 setContent() - 我根本没有搞乱它。

对于某些用户(三星、LG、小米、华为......运行 API 19 至 23)来说,这很奇怪,但不是所有用户,无论我多么努力,也不会发生在我身上。

我怀疑这可能与混淆器有关。

最佳答案

This fix由 Pierre-Yves Ricau 提供,旨在修复 IMM 泄漏,但事实证明这是导致此问题的原因。

解决方案隐藏在评论中:

Use onActivityStarted(Activity) instead of onActivityCreated(Activity, Bundle)

崩溃已为我修复。

关于android - AdMob 崩溃 "requestFeature() must be called before adding content",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40229034/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com