gpt4 book ai didi

android - Flutter:任务 ':location:compileDebugKotlin' 执行失败

转载 作者:行者123 更新时间:2023-12-04 23:53:18 24 4
gpt4 key购买 nike

任务':location:compileDebugKotlin'执行失败。

build:gradle(模块:app)

    ext.kotlin_version = '1.6.10'
repositories {
maven {
//url 'https://dl.google.com/dl/android/maven2',
url 'http://download.flutter.io'
}
google()
mavenCentral()
}

dependencies {
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.android.tools.build:gradle:4.+'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
//classpath("com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.0")
}
}

allprojects {
repositories {
maven {
apply plugin: 'maven'
//url 'https://dl.google.com/dl/android/maven2',
url 'http://download.flutter.io'
}
google()
mavenCentral()
}
}

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

构建:gradle(项目)

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 = '4'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
compileSdkVersion 31

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.develpment.sported_app"
minSdkVersion 23
targetSdkVersion 29
multiDexEnabled true
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
//release {
release {
profile {
matchingFallbacks = ['debug', 'release']
}
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
//}
}
lintOptions {
disable 'InvalidPackage'
checkReleaseBuilds false
}
}

flutter {
source '../..'
}

dependencies {
implementation "com.android.support:multidex:1.0.3"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'com.android.support:support-annotations:28.0.0'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'

已尝试的解决方案:

  1. 使缓存失效/重启
  2. 构建 -> 清理项目
  3. 更新了 Kotlin 插件并使用了最新的 Kotlin 版本
  4. 运行 ./gradlew assembleDebug
  5. 运行 flutter doctorflutter clean

之前我尝试构建发布和发布构建,但某些功能无法正常工作。于是我环顾四周,发现我应该在android部分的MainActivity.kt的main方法中添加下面的代码,这就是这个问题开始的时候。我什至尝试将方法注释掉,但错误仍然存​​在。

覆盖有趣的 configureFlutterEngine(@NonNull flutterEngine:FlutterEngine){GeneratedPluginRegistrant.registerWith(flutterEngine);}

最佳答案

我更新了我所有的项目包。这为我解决了这个问题。

关于android - Flutter:任务 ':location:compileDebugKotlin' 执行失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71781763/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com