[英]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.