微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

颤振| Android Gradle插件仅支持Kotlin Gradle插件版本1.3.0及更高版本

我正在尝试添加firebase依赖项.当我跑到跑步时,我得到了

The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
project ':google_api_availability' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71

Pubscec.yaml

dependencies:
  Flutter:
    sdk: Flutter
  firebase_auth: ^0.8.1
  google_sign_in: ^4.0.1
  cloud_firestore: ^0.9.0+1
  firebase_core: ^0.3.0+1
  firebase_storage: ^2.0.1
  cupertino_icons: ^0.1.2
  font_awesome_Flutter: ^8.0.1
  country_code_picker: ^1.1.0
  Fluttertoast: ^2.0.7
  image_picker: ^0.4.6
  shared_preferences: ^0.4.2
  cached_network_image: ^0.4.1
  intl: ^0.15.7
  geolocator: ^2.1.1
  http: ^0.11.3+14
  Flutter_google_places: ^0.1.4+1
  location: ^1.1.6
  uuid: ^1.0.3
  auto_size_text: 0.3.0

的build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用程序/的build.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.")
}

apply plugin: 'com.android.application'
apply from: "$FlutterRoot/packages/Flutter_tools/gradle/Flutter.gradle"

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.example.myapp"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    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.debug
        }
    }
}

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'
}
apply plugin: 'com.google.gms.google-services'  // Gradle plugin

解决方法:

您可以通过在项目的根目录上运行Flutter packages pub deps来查找依赖于google_api_availability的程序包 – 这将在树视图中列出项目的所有直接和传递依赖项.

我找不到显示包的插件依赖关系的方法 – 我想你只会在尝试构建它时找到它.

问题是您使用的是Android Gradle插件的3.3.1版本,该插件强制执行Kotlin 1.3.0或更高版本.与此同时,geolocator包依赖于google_api_availability,这似乎是使用Kotlin 1.2.71.目前没有使用Kotlin 1.3.0或更高版本的google_api_availability版本,因此您只有1个解决方案 – 将Android Gradle插件降级到版本3.2.1.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐