java找不到参数[org.jetbrains.kotlin:kotlinstdlibjdk7:1.3.50]的方法实现()
我对Android开发和Flitter也是新手。在导出我的应用程序时,我遇到了很多错误,而这些错误目前一直困扰着我。我不知道怎么解决这个问题。如果你们能帮助我,那将是非常有帮助的
获取此错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'F:\GAMES\quiz\安卓\app\build.gradle' line: 88
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not find method implementation() for arguments [org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.50] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDepen
dencyHandler.
* 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 3s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 4.3s
Gradle task assembleRelease failed with exit code 1
我认为gradle文件中一定有一些错误,因此包括以下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 FileNotFoundException("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.安卓.application'
apply plugin: 'kotlin-安卓'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
安卓 {
compileSdkVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
kapt { generateStubs = true }
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.安卓.com/studio/build/application-id.html).
applicationId "com.karat18.quiz"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "安卓x.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
profile {
matchingFallbacks = ['debug', 'release']
}
signingConfig signingConfigs.release
}
}
}
flutter {
source '../..'
}
apply plugin: 'kotlin-安卓'
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.安卓.tools.build:gradle:3.6.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//testImplementation 'junit:junit:4.12'
//安卓TestImplementation '安卓x.test:runner:1.2.0'
//安卓TestImplementation '安卓x.test.espresso:espresso-core:3.2.0'
//implementation 'com.google.firebase:firebase-analytics:17.4.1'
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
}
apply plugin: 'com.安卓.application'
apply plugin: 'com.google.gms.google-services'
# 1 楼答案
添加
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
的dependencies
块位于buildscript
块内。 这意味着您正试图修改生成使用的依赖项,而不是项目使用的依赖项classpath
配置,因此如果这是您的目标,那么用classpath
替换implementation
李>android
块处于同一级别的dependencies
块中声明项目依赖项。有关详细信息,请参见Android documentation。因此,如果这是您的目标,请将该行移动到新的dependencies
块# 2 楼答案
内置。gradle(模块:应用程序)更换
与
而且是内置的。gradle(模块:项目)将版本更改为