android - flutter android - 无法列出 com.google.android.gms :play-services-location 的版本

标签 android flutter

编译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 医生
[✓] 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)

最佳答案

有时是由于互联网连接问题。尝试检查您是否有正确的连接。

关于android - flutter android - 无法列出 com.google.android.gms :play-services-location 的版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55231418/

相关文章:

android - NDK - 包括错误

listview - 我的 listView 只显示一个没有内容的空白页面。我该如何解决?

android - 在 Android 上使用 Alarm Manager 启动服务?

android - 如何在 Android 的 GridView 中使用预加载器

flutter - 在空方法上调用了 '[]'方法。 flutter

android - 如何向 firebase 消息通知添加按钮?

flutter - 在初始化错误中只能访问静态成员

dart - Flutter 在真机上运行报错

android - 在 Android 上使用 native 对话框不使用 Facebook 登录按钮的 Facebook 登录

java - Android camera , onPictureTaken(byte[] imgData, Camera camera) 方法和 PictureCallback 从未调用过