当前位置 : 主页 > 手机开发 > android >

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

来源:互联网 收集:自由互联 发布时间:2021-06-11
我正在尝试添加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_
我正在尝试添加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.

网友评论