What is causing the following build exception in an existing Flutter project after upgrading flutter to 2.10?
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Multiple task action failures occurred:
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.window:window-java:1.0.0-beta04.
AAR metadata file: C:\Users\Blah\.gradle\caches\transforms-2\files-2.1\602ce26881e3b92788ae83c190d3c36f\jetified-window-java-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
> The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-30).
Dependency: androidx.window:window:1.0.0-beta04.
AAR metadata file: C:\Users\Blah\.gradle\caches\transforms-2\files-2.1\9520e6f13992d2f4d96b17b856330597\jetified-window-1.0.0-beta04\META-INF\com\android\build\gradle\aar-metadata.properties.
Flutter 2.10 support for Foldable devices via AndroidX
Flutter 2.10 added support for foldable Android devices.
This relies on Android SDK API version 31's AndroidX library dependency of: androidx.window:window-java:1.0.0
The build failed because:
this new AndroidX dependency requires Android compileSdkVersion of 31 or higher.
It also requires kotlin_version of 1.5.31 or higher.
So existing Flutter/Android projects may need some gradle file changes:
android/build.gradle:
bump ext.kotlin_version to at least 1.5.31 (1.6.10 is available as of Feb 2022)
buildscript {
ext.kotlin_version = '1.5.31'
android/app/build.gradle
bump compileSdkVersion to 31 or higher
android {
compileSdkVersion 31
If you don't have Android 12 SDK (API level 31) installed...
Install & Use SDK API 31 (Android 12) in Android Studio
In Android Studio
go to Tools > SDK Manager > tick/check Android 12 (S) API Level 31 > click OK button > wait for download/install
Platform & Project Settings
Next we need to add Android SDK API 31 to our Project Structure under both Platform Settings and Project Settings
Android Studio > File > Project Structure
Under Platform Settings click SDKs
In the middle column click + icon button, select "Add Android SDK.."
You will be prompted to select an Android SDK directory
Select your Android Sdk root directory like C:\Android\Sdk
do not select the specific API version like C:\Android\Sdk\platforms\android-31. This will be rejected.
A "Create New Android SDK" window will pop up.
By default Java SDK 11 & Build target: Android API 31 will be preselected. If not, select them.
Click OK.
Android API 31 Platform is now available for your Project.
Now under Project Settings, click on Project
On the right under Project SDK:
Click the dropdown list
Select Android API 31 Platform
Click OK
We're done.
Android 12 SDK API 31 is now installed and ready to compile this project.
You should Set both compileSdkVersion and targetSdkVersion to 31 in your build.gradle(app) file.
android {
compileSdkVersion 31 // <-- This
defaultConfig {
applicationId "com.example.app"
targetSdkVersion 31 // <-- and this too
// ...
}
}
I hade the same issue, all those listed above did not for me, what worked for me is that i downgrade the geolocator from 9.0.1 to 7.7.0
Related
When trying to deploy my Flutter app, I'm getting an error that says that the deployment requires SDK version #33.
How can I find what packages in the app require SDK #33?
R
unning Gradle task 'assembleDebug'...
Warning: The plugin url_launcher_android requires Android SDK version 33.
For more information about build configuration, see https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
One or more plugins require a higher Android SDK version.
Fix this issue by adding the following to D:\Ian\Documents\github\good_day\android\app\build.gradle:
android {
compileSdkVersion 33
...
}
android>app>build.gradle
compileSdkVersion 33
targetSdkVersion 33
map_view plugin is no longer maintained and let users with problems if the min sdk is up to 28, so luckily Eimji fork a modified version of the package but it's only on github https://github.com/Eimji/flutter_google_map_view and not on https://pub.dartlang.org I search to add his fork to my pubspec.yaml.
I tried
flutter_google_map_view:
git://github.com/Eimji/flutter_google_map_view.git
Thank you
Update
I changed name by map_view it seems accepted ...
but when I use flutter_google_map_view I have
Error on line 1, column 7 of flutter_google_map_view\pubspec.yaml: "name" field doesn't match expected name "flutter_google_map_view".
I don't know why map_view "works" but not mapview ...So I don't know if it's really accepted or the great methode ...
So now I have other issue when I upload my local map_view package ...
* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
WARNING: The specified Android SDK Build Tools version (25.0.3) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.3'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
> java.lang.AbstractMethodError (no error message)
I search buildToolsVersion '25.0.3 from my build.gradle file , but nothing like this. So I add buildToolsVersion '28.0.3' in build.gradle but have always the same error ...
Update
I remove all "buildToolsVersion '25.0.3'" it seem working and now I have this last issue :
* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
> java.lang.AbstractMethodError (no error message)
I think map_view is not correctly accepted ...
Update
Some suggestions to simply import this github package https://github.com/Eimji/flutter_google_map_view to pubspec.yaml ?
when I use
flutter_google_map_view:
git: git://github.com/Eimji/flutter_google_map_view.git
I have this error ...
Git error. Command: git clone --mirror git://github.com/munificent/map_view.git C:\Users\utilisateur\AppData\Roaming\Pub\Cache\git\cache\map_view-84b47933c6a730a2f0624a589576e53be480ad60
Cloning into bare repository 'C:\Users\utilisateur\AppData\Roaming\Pub\Cache\git\cache\map_view-84b47933c6a730a2f0624a589576e53be480ad60'...
Update
I tried my last chance ! import map_view: ^0.0.14 (no compatible android X) and add manualy all modification did by Eimji https://github.com/Eimji/flutter_google_map_view/commit/5b631c499783936dfc462039274a6f5c59323068#diff-7ae5a9093507568eabbf35c3b0665732
I have this error
* Error running Gradle:
Exit code 1 from: C:\Users\utilisateur\AndroidStudioProjects\nirbi\android\gradlew.bat app:properties:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':map_view'.
> Failed to notify project evaluation listener.
> java.lang.AbstractMethodError (no error message)
See https://www.dartlang.org/tools/pub/dependencies#git-packages
dependencies:
kittens:
git:
url: git://github.com/munificent/kittens.git
ref: some-branch
If pubspec.yaml is not in the root directory you can also specify a path
dependencies:
kittens:
git:
url: git://github.com/munificent/cats.git
path: path/to/kittens
I installed the image_picker plugin into my project, and it works with iOS, But now the Android build crashes with the error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list.
Any idea why the Android build crashes when using this plugin?
You have to enable multidex in your build.gradle file :
android {
.
.
.
defaultConfig {
minSdkVersion //your minimum SDK version
targetSdkVersion //your target SDK version
multiDexEnabled true // this is what you should add
}
}
dependencies {
compile 'com.android.support:multidex:1.0.3'
}
I had to roll back my Firestore plugin to 0.7.4 to fix this: answer found here.
I do also have multidex enabled as other answers suggested - this fixed an earlier crash I encountered with Firebase plugins.
Error:No installed build tools found. Install the Android build tools version 19.1.0 or higher.
Every time i used to gradle sync the project from android studio,I got above error.
Try to change your gradle version in /projectName/build.gradle
classpath 'com.android.tools.build:gradle:x;xxxx'
Then download the new version of the build tools 19.1 and change the following line in /projectName/moduleName/build.gradle
android {
compileSdkVersion 19
buildToolsVersion "19.1" //Set this to 19.1 after SDK update
...
}
Sync your gradle files and it should be working now.
When I try to import https://github.com/TomGrill/gdx-firebase this project in eclipse,I got this error
"Could not find com.android.support:support-v4:24.0.0."
I have done installation of latest android sdk tools 25.2.4 from android sdk manager and updated the following changes in build.gradle.
compileSdkVersion 23
buildToolsVersion "25.2.4"
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
}
currently I am getting this error
"failed to find Build Tools revision 25.2.4"
Can anyone tell me,how do I fix this?
Update
I am still getting this error while importing that project,how to fix this?
"Could not find com.android.support:support-v4:24.0.0."
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/24.0.0/support-v4-24.0.0.pom
https://repo1.maven.org/maven2/com/android/support/support-v4/24.0.0/support-v4-24.0.0.aar
file:/Users/divya/.m2/repository/com/android/support/support-v4/24.0.0/support-v4-24.0.0.pom
file:/Users/divya/.m2/repository/com/android/support/support-v4/24.0.0/support-v4-24.0.0.aar
https://jcenter.bintray.com/com/android/support/support-v4/24.0.0/support-v4-24.0.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/24.0.0/support-v4-24.0.0.aar
https://oss.sonatype.org/content/repositories/snapshots/com/android/support/support-v4/24.0.0/support-v4-24.0.0.pom
https://oss.sonatype.org/content/repositories/snapshots/com/android/support/support-v4/24.0.0/support-v4-24.0.0.aar
https://oss.sonatype.org/content/repositories/releases/com/android/support/support-v4/24.0.0/support-v4-24.0.0.pom
https://oss.sonatype.org/content/repositories/releases/com/android/support/support-v4/24.0.0/support-v4-24.0.0.aar
file:/Applications/android/android-sdk-macosx/extras/google/m2repository/com/android/support/support-v4/24.0.0/support-v4-24.0.0.pom
file:/Applications/android/android-sdk-macosx/extras/google/m2repository/com/android/support/support-v4/24.0.0/support-v4-24.0.0.aar
Required by:
de.tomgrill.gdxfirebase.android:android:0.0.4-SNAPSHOT > com.google.firebase:firebase-database:9.8.0 > com.google.android.gms:play-services-basement:9.8.0
Check buildToolsVersion, you have in Android SDK Manager. Currently latest is 25.0.2.
Android SDK Build-tools is different from
Android SDK Tools(latest 25.2.4) and
Android SDK Platform-tools(latest 25.0.3).
Hopefully it may be helpful
Thanks