> Произошел сбой при выполнении org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 > Произошел сбой при выполнении org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompiler

Сообщение Anonymous »

Я не могу скомпилировать файлы dart из-за ошибки ниже.
e: file:///C:/Users/○○/○○/android/app/src /main/kotlin/com/example/ai_art/MainActivity.kt:5:8 Неразрешенная ссылка: io
e: file:///C:/Users/○○/○○/android/app/src/main/kotlin/com/example/ai_art/MainActivity.kt:7:21 Неразрешенная ссылка: FlutterActivity

э: file:///C:/Users/○○/○○/android/app/src/main/kotlin/com/example/ai_art/MainActivity.kt:8:5 'onCreate' ничего не переопределяет
e: file:///C:/Users/○○/○○/android/app/src/main/kotlin/com/example/ai_art/MainActivity.kt:9:15 Неразрешенная ссылка: onCreate
e: file:///C:/Users/○○/○○/android/app/src/main/kotlin/com/example/ai_art/MainActivity.kt:10:9 Неразрешенная ссылка: RequestOrientation
ОШИБКА: сборка завершилась с ошибкой.
  • Что пошло не так:
    Не удалось выполнить задачу. ':app:compileReleaseKotlin'.
Произошла ошибка при выполнении org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkActionОшибка компиляции. Дополнительную информацию смотрите в журнале.
  • Попробуйте:
< blockquote>
Запустите с параметром --stacktrace, чтобы получить трассировку стека.
Запустите с параметром --info или --debug, чтобы получить больше результатов журнала.
Запустите с --scan чтобы получить полную информацию.
Дополнительную помощь можно получить по адресу https://help.gradle.org.

ОШИБКА СБОРКИ через 54 секунды
Выполнение задачи Gradle 'assembleRelease'... 55,8 секунды
Задача Gradle assembleRelease не удалась с кодом завершения 1
○○ — это секретная строка.
могу ли я просмотреть файлы ниже и просмотреть их что-нибудь?
MainActivity.kt

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

package com.○○.○○

import android.content.pm.ActivityInfo
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
}
}

android/build.gradle

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

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

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

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

buildscript {
ext.kotlin_version = '1.7.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

android/app/build.gradle

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

plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file("local.properties")
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader("UTF-8") { reader ->
localProperties.load(reader)
}
}

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

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

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

android {
namespace = "com.○○.○○"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
buildFeatures {//←この処理を追加
viewBinding true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.○○.○○"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
minSdkVersion 21
targetSdk = flutter.targetSdkVersion
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 {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.release
debug {
resValue "string", "app_name", "○○"
applicationIdSuffix ".debug"
versionNameSuffix "-d"
}
release {
resValue "string", "app_name", "○○"
}
}
}
}

flutter {
source = "../.."
}
android/setting.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
}()

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

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

plugins {
id "com.android.application" version "1.7.21" apply false
id "org.jetbrains.kotlin.android" version "1.8.0" apply false
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
}
}

include ":app"

gradle-wrapper.properties

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

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
Я пытался изменить версию Gradle, например 8.3, 8.1 и т. д.

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

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

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

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

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

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

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