android - flutter android - 无法列出 com.google.android.gms:play-services-location 的版本
问题描述
编译android时出现这个错误,以前编译正常,但我不知道出了什么问题。
Ios 编译并且工作正常。我尝试了一些方法,包括检查 gradle 文件是否有 google() 和正确的版本等,但没有任何帮助。****************************************************** ******* FAILURE:构建失败并出现异常。
WARNING: This version of cloud_firestore will break your Android build if it or its dependencies aren't compatible with AndroidX.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
See goo.gl/CP92wY for more information on the problem and how to fix it.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
> Could not resolve com.google.android.gms:play-services-location:15.+.
*********************************************************
Required by:
project :app > project :location
> Failed to list versions for com.google.android.gms:play-services-location.
> Could not list versions using M2 pattern 'https://raw.github.com/g123k/ShortcutBadger/master/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-location/'.
> Could not GET 'https://raw.github.com/g123k/ShortcutBadger/master/com/google/android/gms/play-services-location/'. Received status code 400 from server: Bad Request
* 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 23s
Finished with error: Gradle task assembleDebug failed with exit code 1
根构建.gradle
buildscript {
repositories {
google()
jcenter()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1' // it was 3.3.1 before but didnt compile, 3.2.1 compiles but with firebase errors
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用程序构建.gradle
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.berkey.berkey"
minSdkVersion 21
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
// implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
// implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//
// android.useAndroidX=true
// android.enableJetifier=true
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
dependencies {
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
发布规范.yaml
description: A new Flutter project.
version: 1.2.0+3
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
algolia: ^0.1.3+2
firebase_auth: ^0.8.0+3
cupertino_icons: ^0.1.2
google_sign_in: ^4.0.1
cloud_firestore: ^0.9.0+1
firebase_storage: ^2.0.1
image_picker: ^0.5.0+3
location: ^2.0.0
firebase_messaging: ^3.0.1
geolocator: ^3.0.0
firebase_core: ^0.3.0+1
flutter_launcher_icons: "^0.7.0"
flutter_linkify: 1.0.3
url_launcher: ^5.0.1
permission_handler: '^2.2.0'
flutter_app_badger: ^1.0.2
扑医生
[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.14.2 18C54, locale en-AU)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
[✓] Android Studio (version 3.3)
[✓] Connected device (1 available)
解决方案
有时是由于互联网连接问题。尝试检查您是否有正确的连接。
推荐阅读
- talend - tLogCatcher 未捕获子作业错误
- python - 将 df1 与 df2 匹配并将其替换为索引值(非内连接)
- c# - 如何在故事板上显示以编程方式添加的元素?
- javascript - VueJs 有像 React 这样的受控和不受控组件的概念吗?
- android - 从外部存储设置背景 png 图像
- java - Apache Spark 数据集转换
- haskell - 如何在堆栈 ghci 中使用自定义前奏?
- javascript - 尽管 JavaScript 中有明确的条件,但函数未执行或重置
- azure - Azure Active Directory 和 Intranet 网站
- apache-spark - 如何在 Apache Spark 独立集群中设置文件路径?