I've been trying to add Admob
to my flutter
application, but it keeps crashing..
Here is what I've tried to do:
I've added This package to my pubspec.yaml
Then I've added this meta-data
to my AndroidManifest.xml
file:
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-here-is-my_app_id_in_admob"/>
result
I get this error when I try to run the program (please note that I didn't add any ads to my .dart
files yet`
> 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)
You can run flutter clean
and it will be solved
From your question, it is not clear whether you use Firebase. You are using the "firebase_admob" package, which requires Google Service file from Firebase inside your project. If you no need a Firebase, I recommend you package admob_flutter . This package simple and works fine in my projects (but it no support Firebase integration).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.