当前位置: 首页 > 知识库问答 >
问题:

“Google Mobile Ads SDK初始化错误”

袁英豪
2023-03-14

这不是这个帖子的重复(他们更新了错误的文件)。

获取错误

java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: 
java.lang.IllegalStateException:

******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
* should follow the instructions here:                                       *
* https://googlemobileadssdk.page.link/admob-android-update-manifest         *
* to add a valid App ID inside the AndroidManifest.                          *
* Google Ad Manager publishers should follow instructions here:              *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
******************************************************************************
<meta-data 
        android:name="com.google.android.gms.ads.APPLICATION_ID" 
        android:value="ca-app-pub-1234567890123456~1234567890"/>
FirebaseAdMob.instance.initialize(appId: "ca-app-pub-1234567890123456~1234567890");
Launching lib\main.dart on Android SDK built for x86 in debug mode...
lib\main.dart
√ Built build\app\outputs\flutter-apk\app-debug.apk.
FATAL EXCEPTION: main
Process: com.dreamalytics.dreamapp, PID: 23404
java.lang.RuntimeException: Unable to get provider com.google.android.gms.ads.MobileAdsInitProvider: 
java.lang.IllegalStateException:

******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
* should follow the instructions here:                                       *
* https://googlemobileadssdk.page.link/admob-android-update-manifest         *
* to add a valid App ID inside the AndroidManifest.                          *
* Google Ad Manager publishers should follow instructions here:              *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
******************************************************************************

    at android.app.ActivityThread.installProvider(ActivityThread.java:6988)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6445)
    at android.app.ActivityThread.access$1300(ActivityThread.java:219)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
Caused by: java.lang.IllegalStateException:

******************************************************************************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers    *
* should follow the instructions here:                                       *
* https://googlemobileadssdk.page.link/admob-android-update-manifest         *
* to add a valid App ID inside the AndroidManifest.                          *
* Google Ad Manager publishers should follow instructions here:              *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest.   *
******************************************************************************

    at com.google.android.gms.internal.ads.zzzo.attachInfo(com.google.android.gms:play-services-ads-lite@@19.6.0:31)
    at com.google.android.gms.ads.MobileAdsInitProvider.attachInfo(com.google.android.gms:play-services-ads-lite@@19.6.0:3)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
    ... 10 more

扑动博士-V

[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.18362.535], locale en-CA)
• Flutter version 1.22.5 at C:\projects\flutter
• Framework revision 7891006299 (4 weeks ago), 2020-12-10 11:54:40 -0800
• Engine revision ae90085a84
• Dart version 2.10.4

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\butto\AppData\Local\Android\sdk
• Platform android-29, build-tools 29.0.2
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.

[!] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (1 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)

完整AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.dreamalytics.dreamapp">

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
     calls FlutterMain.startInitialization(this); in its onCreate method.
     In most cases you can leave this as-is, but you if you want to provide
     additional functionality it is fine to subclass or reimplement
     FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET"/>
<application
    android:name="io.flutter.app.FlutterApplication"
    android:label="Dreamalytics"
    android:icon="@mipmap/launcher_icon">
    <activity
        android:name=".MainActivity"
        android:launchMode="singleTop"
        android:theme="@style/LaunchTheme"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:hardwareAccelerated="true"
        android:windowSoftInputMode="adjustResize">
        <!-- This keeps the window background of the activity showing
             until Flutter renders its first frame. It can be removed if
             there is no splash screen (such as the default splash screen
             defined in @style/LaunchTheme). -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
        <intent-filter>
            <action android:name="FLUTTER_NOTIFICATION_CLICK"/>
            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/notification_icon" />
        <meta-data
            android:name="com.google.firebase.messaging.default_notification_color"
            android:resource="@color/deep_purple" />
        <meta-data
            android:name="com.google.android.gms.ads.AD_MANAGER_APP"
            android:value="true"/>
        <meta-data 
            android:name="com.google.android.gms.ads.APPLICATION_ID" 
            android:value="ca-app-pub-4347201915048498~6120388314"/>
    </activity>
</application>
</manifest>

共有1个答案

唐康安
2023-03-14

结果我在 ion>中的 标记作用域中有这个标记,所以它无法识别。

所以,有这个吗

<manifest>
    <application>
        <activity>
            <meta-data> 
                android:name="com.google.android.gms.ads.APPLICATION_ID" 
                android:value="ca-app-pub-4347201915048498~6120388314"/>
        </activity>
    </application>
</manifest>

当我应该有这个的时候

<manifest>
    <application>
        <activity>
        </activity>
        <meta-data 
            android:name="com.google.android.gms.ads.APPLICATION_ID" 
            android:value="ca-app-pub-4347201915048498~6120388314"/>
    </application>
</manifest>
 类似资料:
  • 问题内容: 我是使用log4j软件包的新手,但看不到错误:这是一个非常简单明了的代码示例: 当我尝试编译时,出现此错误: my.package.logging.TestLogger.main(TestLogger.java:15)上的org.apache.logging.log4j.LogManager.getLogger(LogManager.java:129)处的线程“ main”中的java

  • 我正试图在谷歌地图Android API v2中获得一个带有自定义图标的标记。我刚刚更改了Google提供的一个示例。我添加了到方法中的RawMapViewDemoActivity 但我总是得到一个“IBitmapDescriptorFactory未初始化”。 在BitmapDescriptorFactory中,它说: 在使用此类中的任何方法之前,您必须执行以下操作之一以确保初始化此类: > 等待

  • 我最近安装了适用于Windows 64位的jdk-7u11。它最初运行得很好,我使用javac和java成功地编译和执行了我的java程序。但后来,当我使用javac编译一个文件时,它会顺利进行,当我继续使用java执行该文件时,会出现以下错误: VM初始化期间出错 java/lang/NoClassDefFoundError:java/lang/Object 我该怎么办?我是jdk的新手用户,我

  • 我是一个新的Java学生,正在编写一个程序,它由一个main方法,一个类文件,两个input.txt文件和一个output.txt文件组成。主要方法应该询问用户帐户余额和年息是多少,并从它们各自的文件中导入存款和取款信息,然后在输出文件中显示来自类文件的所有计算。我最初写这个文件是为了要求用户使用扫描仪输入所有这些信息,现在我正在尝试使用文件作为输入来让它工作……这并不是很顺利。 主要方法: }

  • 我有以下Java代码: 但是,当我运行它时,它会抛出以下错误: 我在do之前初始化了变量。while 循环,并在 try. 中设置值。捕获循环。似乎尚未设置该变量。抱歉,如果这是一个相当基本的问题,但我似乎无法弄清楚。

  • 我用Xcode开发了一个“Hello iOS”应用程序,可以在iOS模拟器上用Appium进行测试。然而,当我试图在真正的iPhone/iPad设备上测试同一个应用程序时,我收到了以下错误消息。 这是我的环境。 我尝试了这个命令“brew安装--HEAD ideviceInster”,但得到了另一条错误消息。 有什么解决办法吗?谢谢

  • 我使用spring初始化工具来生成一些工作骨架,我使用MAVEN项目的默认值 https://start.spring.io/ 当我运行(在项目中没有做任何更改)时,我得到了以下错误,知道如何克服它吗? 使现代化 这是pom。xml文件,我没有更改任何内容。。。 更新2

  • 第一次使用http和改装。我正在使用另一个员工的代码,但不能使其工作,即使在进入互联网检查潜在的错误之后。 使用上面的BASE_URL声明,并将其改为null。 错误是 E/AndroidRuntime:致命异常:主进程:,PID:5305 java。lang.Exception初始化错误