Flutter:Gradle 插件仅支持 Kotlin Gradle 插件版本 1.3.10 及更高版本
Flutter: Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher
Android Studio 3.6
扑
条码生成器:https://pub.dev/packages/barcode_generator
在build.gradle中:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.tokend.io" }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在pubspec.yml
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
logger: ^0.8.3
flutter_statusbarcolor: ^0.2.3
intl: ^0.16.1
carousel_slider: ^2.0.0
adler32: ^1.0.0
barcode_generator: ^0.2.7
但是当我尝试 运行 项目时出现错误:
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':barcode_generator' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1
在 build.gradle 文件中将 gradle 版本降级到 中的 3.2.1依赖项 像这样:
类路径'com.android.tools.build:gradle:3.2.1'
将build.gradle中的ext.kotlin_version = '1.3.50'
再次更新为ext.kotlin_version = '1.6.10'
和运行程序。这对我有用。
Android Studio 3.6 扑 条码生成器:https://pub.dev/packages/barcode_generator
在build.gradle中:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.tokend.io" }
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
在pubspec.yml
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
logger: ^0.8.3
flutter_statusbarcolor: ^0.2.3
intl: ^0.16.1
carousel_slider: ^2.0.0
adler32: ^1.0.0
barcode_generator: ^0.2.7
但是当我尝试 运行 项目时出现错误:
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.
The following dependencies do not satisfy the required version:
project ':barcode_generator' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
* 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 2s
Exception: Gradle task assembleDebug failed with exit code 1
在 build.gradle 文件中将 gradle 版本降级到 中的 3.2.1依赖项 像这样:
类路径'com.android.tools.build:gradle:3.2.1'
将build.gradle中的ext.kotlin_version = '1.3.50'
再次更新为ext.kotlin_version = '1.6.10'
和运行程序。这对我有用。