问题描述
执行时出现错误
Flutter build apk --release
and
Flutter build apk
在没有firebase_admob的情况下构建APK时没有错误
由于插件中的AndroidX不兼容,构建失败。该工具将尝试使用Jetfier解决不兼容问题。 正在构建插件firebase_admob ... 由于上述问题,无法构建插件firebase_admob。
我已经表演
Flutter doctor --android-licenses
Flutter clean
错误仍然出现。
下面是扑打医生-v结果
[√] Flutter (Channel stable,1.20.4,on Microsoft Windows [Version 10.0.18362.1082],locale en-US)
• Flutter version 1.20.4 at D:\work\Flutter
• Framework revision fba99f6cf9 (2 weeks ago),2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at D:\work\AndroidSDK
• Platform android-30,build-tools 30.0.2
• ANDROID_HOME = D:\work\AndroidSDK
• ANDROID_SDK_ROOT = D:\work\AndroidSDK
• Java binary at: D:\aplikasi\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.0)
• Android Studio at D:\aplikasi\Android Studio
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (1 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• No issues found!
Pubspec.yaml 版本:1.0.0 + 1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
Flutter:
sdk: Flutter
Flutter_localizations:
sdk: Flutter
intl: ^0.16.0
sqflite: "^0.11.0+1"
Flutter_launcher_icons: "^0.8.0"
image_picker: "0.6.1"
path_provider: ^1.6.16
path: ^1.7.0
provider: ^4.0.1
date_util: ^0.1.4
auto_size_text: ^2.1.0
Flutter_masked_text: ^0.7.0
font_awesome_Flutter: ^8.8.1
firebase_admob: ^0.9.0+9
Flutter_icons:
android: "launcher_icon"
ios: true
image_path: "assets/icon/penqu.png"
cupertino_icons: ^0.1.3
dev_dependencies:
Flutter_test:
sdk: Flutter
module:
androidX: true
解决方法
我设法使用其他软件包版本来解决此问题 并添加firebase_core。
firebase_admob: ^0.9.0+9
然后我对gradle.properties文件进行了如下更改 将gradle-4.10.2-all.zip更改为gradle-5.1.1-all.zip
为什么?
因为它出现在错误消息中。
#Thu Nov 01 21:03:34 PDT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip