I'm not able to build android apk I'm receiving the followings errors below on my flutter project despite using latest targetsdk and minsdk settings any workaround ?
My flutter version :
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-DZ) [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Java version OpenJDK Runtime Environment (build 17.0.11+0-17.0.11b1207.24-11852314)
My JDK : Java(TM) SE Runtime Environment (build 22.0.2+9-70) Java HotSpot(TM) 64-Bit Server VM (build 22.0.2+9-70, mixed mode, sharing)
settings.gradle
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.6.0" apply false
id "org.jetbrains.kotlin.android" version "2.0.20" apply false
id "com.google.gms.google-services" version "4.4.2" apply false
id("com.google.firebase.crashlytics") version "3.0.2" apply false
}
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-all.zip
gradle.properties
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
app/build.gradle
android {
ndkVersion "27.1.12297006"
compileSdkVersion 35
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "xx.xxx.xx"
minSdkVersion 24
targetSdkVersion 35
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
ndk {
debugSymbolLevel 'SYMBOL_TABLE'
}
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
firebaseCrashlytics {
nativeSymbolUploadEnabled true
unstrippedNativeLibsDir 'build/intermediates/merged_native_libs/release/out/lib'
}
ndk {
// replace with 'FULL' if you need more info,
// but note that it will increase the file size of your appbundle dramatically.
debugSymbolLevel 'SYMBOL_TABLE'
}
signingConfig signingConfigs.release
}
}
namespace 'xx.xxx.xx'
}
pubspec.yaml
version: 1.3.3+80
environment:
sdk: ">=2.17.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
cupertino_icons: 1.0.8
firebase_core: 3.4.1
firebase_messaging: 15.1.1
shared_preferences: 2.3.2
intl: 0.19.0
bloc: 8.1.4
url_launcher: 6.3.0
flutter_bloc: 8.1.6
share_plus: 10.0.2
dio: 5.7.0
cached_network_image: 3.4.1
card_swiper: 3.0.1
shimmer: 3.0.0
image_picker: 1.1.2
photo_view: 0.15.0
google_maps_flutter: 2.9.0
intro_views_flutter: 3.2.0
rxdart: 0.28.0
font_awesome_flutter: 10.7.0
flutter_rating_bar: 4.0.1
qr_flutter: 4.1.0
dotted_border: 2.1.0
animations: 2.0.11
flutter_svprogresshud: 1.0.1
#flutter_svprogresshud:
# git:
# url: https://github.com/Syaba999/flutter_svprogresshud
webview_flutter: 4.9.0
showcaseview: 3.0.0
google_mobile_ads: 5.1.0
video_player: 2.9.1
path_provider: 2.1.4
open_filex: 4.5.0
geolocator: 13.0.1
shared_value: ^3.0.0
one_context: ^4.0.0
toast: ^0.3.0
flutter_widget_from_html: 0.15.2
screen_protector: ^1.4.2
flutter_feather_icons: ^2.0.0+1
get: ^4.6.6
connectivity_plus: 6.0.5
new_version_plus: ^0.0.11
rate_my_app: ^2.2.0
flutter_easyloading: ^3.0.5
upgrader: ^11.0.0
# sentry_flutter: ^7.16.1
firebase_crashlytics: ^4.1.1
firebase_performance: ^0.10.0+6
firebase_app_check: ^0.3.1+1
#ios
firebase_analytics: ^11.3.1
flutter_map: ^7.0.2
latlong2: ^0.9.1
qr_code_scanner: 1.0.1
#qr_code_scanner:
# git:
# url: https://github.com/samnbd/qr_code_scanner
# ref: master
#version: ^1.0.0
#qr_code_scanner:
# git:
# url: https://github.com/dola99/qr_code_scanner
# ref: update
syncfusion_flutter_pdfviewer: ^26.2.8
in_app_review: 2.0.9
flutter_colorpicker: 1.1.0
shorebird_code_push: ^1.1.4
restart_app: ^1.3.2
assistive_touch: 0.2.0
pin_code_fields: 8.0.1
location: ^7.0.0
device_info_plus: 10.1.2
dependency_overrides:
package_info_plus: 8.0.2
# http: ^1.2.2
web: ^1.0.0
Error logs :
1: Task failed with an exception.
-----------
* What went wrong:
Unable to make progress running work. There are items queued for execution but none of them can be started
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':open_filex:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [androidx.fragment:fragment:1.7.1] /Users/g-besoin/.gradle/caches/8.10.1/transforms/6794493f0b6fdfd574744e6342ad8026/transformed/fragment-1.7.1/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="androidx.fragment" to force usage (may lead to runtime failures)
3: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':geolocator_android:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [com.google.android.gms:play-services-location:21.2.0] /Users/g-besoin/.gradle/caches/8.10.1/transforms/9f900b64ef0ab40207bfa7eabcd4c437/transformed/jetified-play-services-location-21.2.0/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="com.google.android.gms.location" to force usage (may lead to runtime failures)
4: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':flutter_svprogresshud:checkDebugAndroidTestAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> 20 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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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-viewmodel:2.7.0' requires libraries and applications that
depend on it to compile against version 34 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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-livedata-core:2.7.0' requires libraries and applications that
depend on it to compile against version 34 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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-savedstate:2.7.0' requires libraries and applications that
depend on it to compile against version 34 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.core:core:1.13.1' requires libraries and applications that
depend on it to compile against version 34 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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.savedstate:savedstate:1.2.1' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 33, for example 35.
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.profileinstaller:profileinstaller:1.3.1' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 33, for example 35.
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).
16. Dependency 'androidx.startup:startup-runtime:1.1.1' requires libraries and applications that
depend on it to compile against version 31 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 31, for example 35.
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).
17. Dependency 'androidx.tracing:tracing:1.2.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 33, for example 35.
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).
18. Dependency 'androidx.arch.core:core-runtime:2.2.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 33, for example 35.
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).
19. Dependency 'androidx.window.extensions.core:core:1.0.0' requires libraries and applications that
depend on it to compile against version 33 or later of the
Android APIs.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 33, for example 35.
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).
20. 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.
:flutter_svprogresshud is currently compiled against android-28.
Recommended action: Update this project to use a newer compileSdk
of at least 34, for example 35.
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: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':flutter_svprogresshud:processDebugAndroidTestManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [androidx.fragment:fragment:1.7.1] /Users/g-besoin/.gradle/caches/8.10.1/transforms/6794493f0b6fdfd574744e6342ad8026/transformed/fragment-1.7.1/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 19,
or use tools:overrideLibrary="androidx.fragment" to force usage (may lead to runtime failures)
6: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> An issue was found when checking AAR metadata:
1. Dependency ':qr_code_scanner' requires core library desugaring to be enabled
for :app.
See https://developer.android.com/studio/write/java8-support.html for more
details.
7: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':qr_code_scanner:compileDebugKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileDebugJavaWithJavac' (1.8) and 'compileDebugKotlin' (17).
I was having the exact same issue. Let me describe how I resolved it. First of all, the recommended action of 'Update this project to use a newer compileSdk of at least 34, for example 35.' is not about your app, it recommends increasing compileSdk of google_mobile_ads.
In your app's build.gradle, revert compileSdk and targetSdk as follows:
compileSdk = flutter.compileSdkVersion
targetSdk = flutter.targetSdkVersion
Find the build.gradle of google_mobile_ads. It should be '~/.pub-cache/hosted/pub.dev/google_mobile_ads-5.1.0/android/build.gradle'. Change the compileSdk as 34 and also disable 'MissingClass' in lintOptions:
android {
compileSdk 34
...
lintOptions {
...
disable 'MissingClass'
}
...
}
I tested the functionality with an Interstitial Ad on iOS and Android, it seems working. Let me know if it works for you. Here is the plugin versions from my settings.gradle for your reference:
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version '8.6.0' apply false
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
id "com.google.gms.google-services" version "4.4.2" apply false
id "com.google.firebase.crashlytics" version "3.0.2" apply false
}