flutterに関して環境構築中にエラー...助けてください
解決したいこと
flutterのビルドの際にエラーが出ていて先に進めません。
わかる方いらっしゃいますか?
発生している問題・エラー
PS C:\Users\miyajima\StudioProjects\app> fvm flutter run --flavor dev
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
FAILURE: Build failed with an exception.
* Where:
Settings file 'C:\Users\miyajima\StudioProjects\yattoruyo_app\android\settings.gradle' line: 2
* What went wrong:
Plugin [id: 'dev.flutter.flutter-plugin-loader', version: '1.0.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'dev.flutter.flutter-plugin-loader:dev.flutter.flutter-plugin-loader.gradle.plugin:1.0.0')
Searched in the following repositories:
Gradle Central Plugin Repository
* 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 813ms
Running Gradle task 'assembleDevDebug'... 994ms
Error: Gradle task assembleDevDebug failed with exit code 1
または、問題・エラーが起きている画像をここにドラッグアンドドロップ
### 該当するソースコード
```言語名
dart
発生している問題・エラー
Launching lib\main.dart on sdk gphone64 x86 64 in debug mode...
e: file:///C:/Users/miyajima/StudioProjects/yattoruyo_app/android/app/src/main/kotlin/cc/sysad/yattoruyo_app/MainActivity.kt:3:8 Unresolved reference: io
e: file:///C:/Users/miyajima/StudioProjects/yattoruyo_app/android/app/src/main/kotlin/cc/sysad/yattoruyo_app/MainActivity.kt:5:21 Unresolved reference: FlutterActivity
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDevDebugKotlin'.
> 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 12s
Running Gradle task 'assembleDevDebug'... 13.0s
Error: Gradle task assembleDevDebug failed with exit code 1
### 該当するソースコード
```言語名
dart
fvm flutter --version
Flutter 3.32.8 • channel stable • https://github.com/flutter/flutter.git
Tools • Dart 3.8.1 • DevTools 2.45.1
settings.gralle↓↓
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.3.0" apply false
id "com.google.gms.google-services" version "4.3.15" apply false
id "org.jetbrains.kotlin.android" version "1.9.0" apply false
}
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
//apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
include ':app'
android/build.gralle↓↓
buildscript {
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.7.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.2'
// classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.layout.buildDirectory
}
android/app/build.gralle↓↓
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'
}
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'
}
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
//apply plugin: 'com.android.application'
//apply plugin: 'kotlin-android'
//apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
namespace "cc.sysad.yattoruyo_app"
compileSdkVersion 35
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "cc.sysad.yattoruyo_app"
minSdkVersion 24
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
develop {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword'] }
}
flavorDimensions "default"
productFlavors {
dev {
dimension "default"
applicationIdSuffix ".dev"
versionNameSuffix ".dev"
// アプリケーション名を変更したい場合
resValue "string", "app_name", "(dev)"
resValue "string", "facebook_app_id", ""
resValue "string", "fb_login_protocol_scheme", ""
manifestPlaceholders = [ applicationName: "io.flutter.app.FlutterApplication" ]
}
prod {
dimension "default"
// アプリケーション名を変更したい場合
resValue "string", "app_name", ""
resValue "string", "facebook_app_id", ""
resValue "string", "fb_login_protocol_scheme", ""
manifestPlaceholders = [ applicationName: "io.flutter.app.FlutterApplication" ]
}
}
buildTypes {
release {
signingConfig signingConfigs.release
signingConfig signingConfigs.debug
}
}
}
//flutter {
// source '../..'
//}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:21.1.0'
implementation 'com.google.firebase:firebase-crashlytics:18.2.11'
implementation 'androidx.multidex:multidex:2.0.1'
implementation "com.android.installreferrer:installreferrer:2.2"
}
//apply plugin: 'com.google.gms.google-services'
//apply plugin: 'com.google.firebase.crashlytics'
gradle-wrapper.properties↓↓
#Fri Jun 23 08:50:38 CEST 2017
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
自分で試したこと
もとのコードは前任から引き継いだのでどのように作っていたかはわかりませんがAPIレベル34までは更新していたようです。
今回やりたいこととしてはAPIレベル35にしたいです。
キャッシュクリアやバージョン変更、などは試してみました。
chatGPTが言うにはMainActivity.ktが壊れている可能性があるとのことですが
原因わかる方いらっしゃいますか?