I'm getting the below issue.
Running Gradle task 'assembleDebug'...
e: file:///Users/technologies/Documents/MyComputer/project_git/android/app/src/main/kotlin/com/example/testproject/MainActivity.kt:4:8 Unresolved reference: io e: file:///Users/technologies/Documents/MyComputer/project_git/android/app/src/main/kotlin/com/example/testproject/MainActivity.kt:7:21 Unresolved reference: FlutterFragmentActivity
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:compileDebugKotlin'.
A failure occurred while executing org.jetbrains.kotlinpilerRunner.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 .
package com.app.myproject
//import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() {
}
Please help me for this. Thanks in Advance.
I'm getting the below issue.
Running Gradle task 'assembleDebug'...
e: file:///Users/technologies/Documents/MyComputer/project_git/android/app/src/main/kotlin/com/example/testproject/MainActivity.kt:4:8 Unresolved reference: io e: file:///Users/technologies/Documents/MyComputer/project_git/android/app/src/main/kotlin/com/example/testproject/MainActivity.kt:7:21 Unresolved reference: FlutterFragmentActivity
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.
package com.app.myproject
//import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() {
}
Please help me for this. Thanks in Advance.
Share Improve this question edited Feb 6 at 10:51 Alpit Panchal asked Feb 6 at 10:25 Alpit PanchalAlpit Panchal 1,0374 gold badges15 silver badges34 bronze badges1 Answer
Reset to default 0This type of error usually occurs when there is a problem with the Flutter and Kotlin dependencies in your Android project. In this case, the FlutterFragmentActivity class cannot be resolved correctly.
-Review your dependencies: Make sure that the required dependencies are included in your app's build.gradle file in the dependencies section
implementation 'io.flutter:flutter_embedding_debug:<flutter_version>'
-Update Flutter and Gradle
Check your project settings on Android: Make sure your project is properly configured to work with Flutter. Open the MainActivity.kt file and verify that the import and class are correct
package com.app.myproject
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() { }