【发布时间】:2020-08-29 21:51:45
【问题描述】:
我也是 Android 开发和 Flutter 的新手。在导出我的应用程序时,我遇到了很多当前卡在此错误上的错误。不知道如何解决这个问题。如果你们能帮助我,那将是非常有帮助的!
收到此错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'F:\GAMES\quiz\android\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.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android {
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.android.com/studio/build/application-id.html).
applicationId "com.karat18.quiz"
minSdkVersion 16
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.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-android'
buildscript {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.android.tools.build:gradle:3.6.3'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'androidx.test:runner:1.2.0'
//androidTestImplementation 'androidx.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.android.application'
apply plugin: 'com.google.gms.google-services'
【问题讨论】:
标签: java android flutter kotlin gradle