mapbox-maps-flutter icon indicating copy to clipboard operation
mapbox-maps-flutter copied to clipboard

Cannot create builds with compileSdk 36

Open rahulrmishra opened this issue 3 months ago • 2 comments

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':mapbox_maps_flutter:checkReleaseAarMetadata'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction 15 issues were found when checking AAR metadata:

   1.  Dependency 'androidx.fragment:fragment:1.7.1' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   2.  Dependency 'androidx.window:window:1.2.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   3.  Dependency 'androidx.window:window-java:1.2.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   4.  Dependency 'androidx.activity:activity:1.8.1' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   5.  Dependency 'androidx.lifecycle:lifecycle-livedata-core-ktx:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   6.  Dependency 'androidx.lifecycle:lifecycle-livedata:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   7.  Dependency 'androidx.lifecycle:lifecycle-livedata-core:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   8.  Dependency 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

   9.  Dependency 'androidx.lifecycle:lifecycle-viewmodel:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

  10.  Dependency 'androidx.lifecycle:lifecycle-process:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

  11.  Dependency 'androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

  12.  Dependency 'androidx.core:core-ktx:1.13.1' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

  13.  Dependency 'androidx.core:core:1.13.1' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

  14.  Dependency 'androidx.lifecycle:lifecycle-runtime:2.7.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

  15.  Dependency 'androidx.annotation:annotation-experimental:1.4.0' requires libraries and applications that
       depend on it to compile against version 34 or later of the
       Android APIs.

       :mapbox_maps_flutter is currently compiled against android-33.

       Recommended action: Update this project to use a newer compileSdk
       of at least 34, for example 36.

       Note that updating a library or application's compileSdk (which
       allows newer APIs to be used) can be done separately from updating
       targetSdk (which opts the app in to new runtime behavior) and
       minSdk (which determines which devices the app can be installed
       on).

Output of flutter --version

Flutter 3.35.5 • channel stable • https://github.com/flutter/flutter.git
Framework • revision ac4e799d23 (7 days ago) • 2025-09-26 12:05:09 -0700
Engine • hash 0274ead41f6265309f36e9d74bc8c559becd5345 (revision d3d45dcf25) (6 days ago) • 2025-09-26 16:45:18.000Z
Tools • Dart 3.9.2 • DevTools 2.48.0

build.gradle file

android {
    compileSdk = 36
    ndkVersion = "27.0.12077973"

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = 17
    }

    defaultConfig {
        minSdkVersion = flutter.minSdkVersion
        targetSdk = 36
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

rahulrmishra avatar Oct 03 '25 08:10 rahulrmishra

Summary

The build fails at :mapbox_maps_flutter:checkReleaseAarMetadata because the plugin is compiled with compileSdkVersion 33, while several AndroidX dependencies (e.g., fragment 1.7.x, window 1.2.x, core-ktx 1.13.x, lifecycle 2.7.x) now require compileSdk ≥ 34.

Root cause

mapbox_maps_flutter/android/build.gradle still uses compileSdkVersion 33. This causes Gradle’s AAR metadata check to fail since your app (or its transitive dependencies) needs a higher SDK.

Fix / Workaround

I’ve created a PR in the official repo to bump the compileSdkVersion to 34. (https://github.com/mapbox/mapbox-maps-flutter/pull/1039) While we are waiting for it to be merged, you can point to my forked repository with the commit hash:

dependencies:
  mapbox_maps_flutter:
    git:
      url: https://github.com/vitorDevop/mapbox-maps-flutter.git
      ref: 8ab9a732eb408acc0dbc0391f78d905e1bc37c06

Then clean & rebuild:

flutter clean
flutter pub get
flutter build apk --release

vitorDevop avatar Oct 05 '25 09:10 vitorDevop

Summary

The build fails at :mapbox_maps_flutter:checkReleaseAarMetadata because the plugin is compiled with compileSdkVersion 33, while several AndroidX dependencies (e.g., fragment 1.7.x, window 1.2.x, core-ktx 1.13.x, lifecycle 2.7.x) now require compileSdk ≥ 34.

Root cause

mapbox_maps_flutter/android/build.gradle still uses compileSdkVersion 33. This causes Gradle’s AAR metadata check to fail since your app (or its transitive dependencies) needs a higher SDK.

Fix / Workaround

I’ve created a PR in the official repo to bump the compileSdkVersion to 34. (#1039) While we are waiting for it to be merged, you can point to my forked repository with the commit hash:

dependencies: mapbox_maps_flutter: git: url: https://github.com/vitorDevop/mapbox-maps-flutter.git ref: 8ab9a732eb408acc0dbc0391f78d905e1bc37c06

Then clean & rebuild:

flutter clean flutter pub get flutter build apk --release

Thank you for this! I need to release today and it's been a severe issue.

I will add more context with Android 16 KB Alignment because it also needs to be updated

lib/arm64-v8a/libc++_shared.so
lib/arm64-v8a/libmapbox-common.so
lib/arm64-v8a/libmapbox-maps.so
lib/x86_64/libc++_shared.so
lib/x86_64/libmapbox-common.so
lib/x86_64/libmapbox-maps.so
Starting November 1st, 2025, all new apps and updates to existing apps submitted to Google Play and targeting Android 15+ devices must support 16 KB page sizes. For more information about compatibility with 16 KB devices

ellie-me avatar Oct 06 '25 16:10 ellie-me