skip to Main Content

I’ve installed the Flutter SDK and Android Studio, and I’ve set everything up. However, when I try to run the project, I’m facing this error.

Flutter Version: 3.27.1

Java Version: 17.0.3

Error Message:

Launching libmain.dart on sdk gphone64 x86 64 in debug mode...
Checking the license for package Android SDK Platform 34 in C:UsersLogithJAppDataLocalAndroidSdklicenses
License for package Android SDK Platform 34 accepted.
Preparing "Install Android SDK Platform 34 (revision: 3)".
"Install Android SDK Platform 34 (revision: 3)" ready.
Installing Android SDK Platform 34 in C:UsersLogithJAppDataLocalAndroidSdkplatformsandroid-34
"Install Android SDK Platform 34 (revision: 3)" complete.
"Install Android SDK Platform 34 (revision: 3)" finished.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     aapt2.exe E 01-13 13:06:02  4124  1996 LoadedArsc.cpp:94] RES_TABLE_TYPE_TYPE entry offsets overlap actual entry data.
     aapt2.exe E 01-13 13:06:02  4124  1996 ApkAssets.cpp:149] Failed to load resources table in APK 'C:UsersLogithJAppDataLocalAndroidSdkplatformsandroid-35android.jar'.
     error: failed to load include path C:UsersLogithJAppDataLocalAndroidSdkplatformsandroid-35android.jar.


* 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 3m 10s
Running Gradle task 'assembleDebug'...                            191.9s

┌─ Flutter Fix ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ [!] Using compileSdk 35 requires Android Gradle Plugin (AGP) 8.1.0 or higher.                                                         │
│  Please upgrade to a newer AGP version. The version of AGP that your project uses is likely defined in:                               │
│ C:UsersLogithJprojects<Project Name>androidsettings.gradle,                                                                 │
│ in the 'plugins' closure (by the number following "com.android.application").                                                         │
│  Alternatively, if your project was created with an older version of the templates, it is likely                                      │
│ in the buildscript.dependencies closure of the top-level build.gradle:                                                                │
│ C:UsersLogithJprojects<Project Name>androidbuild.gradle,                                                                    │
│ as the number following "com.android.tools.build:gradle:".                                                                            │
│                                                                                                                                       │
│  Finally, if you have a strong reason to avoid upgrading AGP, you can temporarily lower the compileSdk version in the following file: │
│ C:UsersLogithJprojects<Project Name>androidappbuild.gradle                                                                 │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Error: Gradle task assembleDebug failed with exit code 1```

2

Answers


  1. compileSdkVersion 35 is required AGP 8.1.0 or newer

    you can fix by update AGP version in settings.gradle

    plugins {
        id "dev.flutter.flutter-plugin-loader" version "1.0.0"
        id "com.android.application" version "8.7.0" apply false <--- This one 
        id "org.jetbrains.kotlin.android" version "1.9.10" apply false <--- Kotlin version
    }
    

    or just downgrade your compileSdkVersion that compatible with your current AGP

    Login or Signup to reply.
  2. I faced the same issue. If downgrading compileSdkVersion is not an option for you, try Upgrading Android Studio and upgrading Flutter to the latest version It helped me. Below are the versions that worked for me.

    Android Studio Ladybug Feature Drop | 2024.2.2

    Flutter version – 3.27.1

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search