Как исправить выполнение не удалось для задачи »: приложение: compiledebugkotlin 'Android

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Как исправить выполнение не удалось для задачи »: приложение: compiledebugkotlin '

Сообщение Anonymous »

Я застрял на проблеме кодирования и мог бы использовать некоторую помощь.
Не могли бы вы предложить то, что мне не хватает, или указать мне на решение? Заранее спасибо за ваше время!
Вот проблема:

Код: Выделить всё

Running Gradle task 'assembleDebug'...
e: file:///D:/Flutter%20projects/ViserBank%20v2.0%20App/Files/android/app/src/main/kotlin/dev/vlab/viser_bank/MainActivity.kt:3:8 Unresolved reference 'io'.
e: file:///D:/Flutter%20projects/ViserBank%20v2.0%20App/Files/android/app/src/main/kotlin/dev/vlab/viser_bank/MainActivity.kt:5:21 Unresolved reference 'FlutterActivity'.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error.  See log for more details

* 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 10m 29s
Error: Gradle task assembleDebug failed with exit code 1

settings.gradle

Код: Выделить всё

pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}
settings.ext.flutterSdkPath = flutterSdkPath()

includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
//id "dev.flutter.flutter-plugin-loader" version "1.0.0"
// Update Gradle and Kotlin versions here
id "com.android.application" version '8.7.0' apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
//id "com.google.gms.google-services" version "4.4.2" apply false
//id "com.google.firebase.crashlytics" version "3.0.2" apply false
// https://kotlinlang.org/docs/gradle-configure-project.html?utm_campaign=gradle-jvm-toolchain&utm_medium=kgp&utm_source=warnings#gradle-java-toolchains-support
id "org.gradle.toolchains.foojay-resolver-convention" version "0.8.0"
}

include ":app"
gradle.properties

Код: Выделить всё

org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
android/build.gradle

Код: Выделить всё

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:8.1.0'
}
}

allprojects {
repositories {
google()
mavenCentral()
}
}

rootProject.buildDir = '../build'

subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
delete rootProject.buildDir
}

App/build.gradle

Код: Выделить всё

plugins {
id 'com.android.application'
id 'kotlin-android'
id 'dev.flutter.flutter-gradle-plugin'
//id 'com.google.gms.google-services'
//id 'com.google.firebase.crashlytics'
}

// If local properties file doesn't exist, use some default values if possible
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

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

// Update Android SDK versions here
// Android SDK levels defined here:
// https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels
def flutterCompileSdkVersion = 35
def flutterMinSdkVersion = 24 // Android 7.0
def flutterTargetSdkVersion = 35

kotlin {
jvmToolchain(17) // Java version defined here
}

android {
namespace 'dev.vlab.viser_bank'

compileSdk flutterCompileSdkVersion

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

defaultConfig {
applicationId 'dev.vlab.viser_bank'
minSdkVersion flutterMinSdkVersion
targetSdkVersion flutterTargetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}

buildTypes {
debug {
// This differentiated release from debug build, but it prevented debug build from
// seeing subscription products. See also `android/app/src/debug/google-services.json`.
//applicationIdSuffix '.debug'
debuggable true
}

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
}
}

compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
}
}

flutter {
source '../..'
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'
}
< /code>
**GRADLE-wrapper.properties ** < /p>
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
mainactivity.kt

Код: Выделить всё

package dev.vlab.viser_bank

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity()

Когда я нажимаю по пути файла, я получил этот диалог

Подробнее здесь: https://stackoverflow.com/questions/796 ... ebugkotlin
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Android»