[英]how to properly integrate Admob in a flutter app
我一直在尝试将Admob
添加到我的flutter
应用程序中,但它一直在崩溃。
这是我尝试做的事情:
我已将此package 添加到我的pubspec.yaml
然后我将此meta-data
添加到我的AndroidManifest.xml
文件中:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-here-is-my_app_id_in_admob"/>
结果
当我尝试运行程序时出现此错误(请注意,我尚未在我的.dart
文件中添加任何广告`
> File 'com.android.builder.files.ZipCentralDirectory@d8f9ce4' was deleted, but previous version not found in cache
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> File 'com.android.builder.files.ZipCentralDirectory@5977de6b' was deleted, but previous version not found in cache
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
==============================================================================
* Get more help at https://help.gradle.org
BUILD FAILED in 7s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
你可以运行flutter clean
就可以解决了
从您的问题来看,尚不清楚您是否使用 Firebase。 您正在使用“firebase_admob”package,这需要在您的项目中来自 Firebase 的 Google 服务文件。 如果您不需要 Firebase,我推荐您 package admob_flutter 。 这个 package 简单并且在我的项目中工作正常(但它不支持 Firebase 集成)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.