集成firebase_admob时android清单中的元数据错误

问题描述

我正在使用

firebase_admob: ^0.11.0+1

我在清单文件中添加了元数据如下(在最后):

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.aa_store">
    
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <application
        android:name="io.flutter.app.FlutterApplication"
        android:label="AA Store"
        android:icon="@mipmap/ic_launcher">
        <provider
    android:name="vn.hunghd.flutterdownloader.DownloadedFileProvider"
    android:authorities="${applicationId}.flutter_downloader.provider"
    android:exported="false"
    android:grantUriPermissions="true">
    <meta-data
        android:name="android.support.FILE_PROVIDER_PATHS"
        android:resource="@xml/provider_paths"/>
</provider>
        <activity
            android:name=".MainActivity"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
          <meta-data
            android:name="com.google.android.gms.ads.APPLICATION_ID"
            android:value="here I used my admob id like ca-app-pub- and so"/>
    </application>
</manifest>

在构建应用程序时,我在调试控制台中收到以下错误消息。

FAILURE:构建失败,出现异常。

  • 出了什么问题: 任务“:app:processDebugResources”执行失败。

执行 com.android.build.gradle.internal.tasks.Workers$ActionFacade 时发生故障 Android 资源链接失败 C:\Users\admin.gradle\caches\transforms-2\files-2.1\3159b380b6099786f8f1e3b5a96c779b\play-services-ads-lite-19.7.0\AndroidManifest.xml:27:5-43:15: 意外错误AAPT在 .

中找到的元素
  • 试试: 使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org

    获得更多帮助

在 3m 26s 内构建失败 构建失败可能是由于插件中的 AndroidX 不兼容。该工具即将尝试使用Jetfier来解决不兼容问题。 构建插件连接...

FAILURE:构建失败,出现异常。

  • 出了什么问题: 在根项目“connectivity”中找不到任务“assembleAarRelease”。

  • 试试: 运行 gradlew tasks 以获取可用任务的列表。使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。使用 --scan 运行以获得完整的见解。

  • https://help.gradle.org

    获得更多帮助

在 12 秒内构建失败

异常:由于上述问题,无法建立插件连接。

我还在应用级网格中添加了 google-services json 文件。 请任何人帮我解决这个问题。谢谢

解决方法

昨天我在添加 firebase_admob 时遇到了同样的错误。 就我而言,我更新了这个

来自:

classpath 'com.android.tools.build:gradle:3.5.0'

到:

classpath 'com.android.tools.build:gradle:3.5.4'

在我的 android/build.gradle 中,它运行良好!

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...