Closed LuisChiej closed 1 month ago
Use the flutter stable channel. You are using channel master Channel master, 3.24.0-1.0.pre.296
With last stable I have same issue
Same issue, #633 does not solve for me. I try to downgrade to mapbox_maps_flutter: ^2.0.0, still have the same issue. The problem appears to be only in Android, while iOS works fine.
@DMrubencesario what error do you get?
@ThomasAunvik the same of @LuisChiej.
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.0, on macOS 13.6 22G120 darwin-arm64, locale it-IT) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.92.0) [✓] Connected device (4 available) [✓] Network resources
@DMrubencesario exactly the same error with the fix of #633 ?
If so, then the dependency isn't getting pulled from git and you would still be using the package from pub.dev.
My workaround was to downgrade from Flutter 3.24.0 to 3.22.3.
@jnorkus yep, had same issue. and had same temp solution aka downgraded to 3.22.2; compiles fine.
Current Flutter 3.24.0 is still getting the issues
Latest plugin version 2.2.0 still has the same issue.
Latest plugin version 2.2.0 and my flutter version. 3.24.1 i still get this error. I cannot downgrade version to lower one because of video_player plugin
flutter version. 3.24.1 still error. any solution for this?
Getting this with Flutter 3.24.1 and mapbox_maps_flutter-2.2.0. Any solutions to not downgrade flutter? Only Android Problem. iOS builds
Hi all, sorry for the trouble, this issue is happening with Flutter SDK 3.24 as it bumped the version of androidx.lifecycle dependency. This issue affects only Android, iOS still compiles fine. We have addressed this in https://github.com/mapbox/mapbox-maps-flutter/pull/671, which is being released today as in a patch release 2.2.1.
After upgrading to 2.2.1 without changing nothing else the the error on top goes away but now it can't compile again giving me the following error:
ERROR:/Users/*/.gradle/caches/transforms-3/3e4c7e3f47ed5eda34cc39a74693193b/transformed/lifecycle-livedata-core-2.8.4-runtime.jar: D8: java.lang.NullPointerException Failure: Build completed with 2 failures. Task failed with an exception.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform lifecycle-livedata-core-2.8.4.aar (androidx.lifecycle:lifecycle-livedata-core:2.8.4) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=24, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}. Execution failed for DexingNoClasspathTransform: /Users/rcesario/.gradle/caches/transforms-3/3e4c7e3f47ed5eda34cc39a74693193b/transformed/lifecycle-livedata-core-2.8.4-runtime.jar. Error while dexing.
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.0, on macOS 13.6 22G120 darwin-arm64, locale it-IT) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.3) [✓] VS Code (version 1.92.0) [✓] Connected device (4 available) [✓] Network resources
I tried to change some kotlin & gradle version but i can't solve the problem. Anyone else has the same problem?
@DMrubencesario try with the following fix in comment: https://github.com/mapbox/mapbox-maps-flutter/pull/633#issuecomment-2275225659
can you try upgrading your gradle version?
This is what i use that works for me:
android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
android/settings.gradle
pluginManagement { def flutterSdkPath = { def properties = new Properties() file("local.properties").withInputStream { properties.load(it) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath } settings.ext.flutterSdkPath = flutterSdkPath() includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version '8.4.1' apply false id "org.jetbrains.kotlin.android" version "1.9.22" apply false id "com.google.gms.google-services" version "4.4.1" apply false id "com.google.firebase.firebase-perf" version "1.4.2" apply false id "com.google.firebase.crashlytics" version "3.0.1" apply false } include ":app"
And, if still not working, do you mind sharing your configs?
Having the same issue as @DMrubencesario after going to 2.2.1. Upgrading Gradle from 7.6.3 to 8.6 resulted in the same build error:
ERROR:/home/lith/.gradle/caches/transforms-4/6968f2560310abc50484d452b3cc903f/transformed/lifecycle-livedata-core-2.8.4-runtime.jar: D8: java.lang.NullPointerException
...
Edit: re-ran with new project so all configurations except gradle version should be the default for a Flutter 3.24.1 project. Same error unfortunately.
Having the same issue as @DMrubencesario after going to 2.2.1. But only on debug Builds with Gradle 7.6 (I can not upgrade to gradle 8+ as share package exist indirectly and will not let build), Release builds without problem: ERROR:/Users/user/.gradle/caches/transforms-3/f12166f053dc25a0be8380f6381377ec/transformed/lifecycle-livedata-core-2.8.4-runtime.jar: D8: java.lang.NullPointerException
Just found what specifically is the issue and what fixes it:
In your_proj/android/settings.gradle
change the version of id "com.android.application"
to something newer, like "8.4.1". Mine was originally "7.3.0".
Updated settings.gradle:
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.4.1" apply false// <-- Here
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}
include ":app"
@hiloliddinj I also tried with Gradle version 7.6.3 and it failed, asked for 8.6. So this doesn't fully solve your issue. This chart might help find the version combo that works for you
Just found what specifically is the issue and what fixes it: In
your_proj/android/settings.gradle
change the version ofid "com.android.application"
to something newer, like "8.4.1". Mine was originally "7.3.0".Updated settings.gradle:
pluginManagement { def flutterSdkPath = { def properties = new Properties() file("local.properties").withInputStream { properties.load(it) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath }() includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.4.1" apply false// <-- Here id "org.jetbrains.kotlin.android" version "1.7.10" apply false } include ":app"
@hiloliddinj I also tried with Gradle version 7.6.3 and it failed, asked for 8.6. So this doesn't fully solve your issue. This chart might help find the version combo that works for you
Thanks a lot mate. you saved my countless hours trying to solve this problem 😁👍
Just found what specifically is the issue and what fixes it: In
your_proj/android/settings.gradle
change the version ofid "com.android.application"
to something newer, like "8.4.1". Mine was originally "7.3.0".Updated settings.gradle:
pluginManagement { def flutterSdkPath = { def properties = new Properties() file("local.properties").withInputStream { properties.load(it) } def flutterSdkPath = properties.getProperty("flutter.sdk") assert flutterSdkPath != null, "flutter.sdk not set in local.properties" return flutterSdkPath }() includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") repositories { google() mavenCentral() gradlePluginPortal() } } plugins { id "dev.flutter.flutter-plugin-loader" version "1.0.0" id "com.android.application" version "8.4.1" apply false// <-- Here id "org.jetbrains.kotlin.android" version "1.7.10" apply false } include ":app"
@hiloliddinj I also tried with Gradle version 7.6.3 and it failed, asked for 8.6. So this doesn't fully solve your issue. This chart might help find the version combo that works for you
Thanks mate. I also deleted "share" package containing package (it was Alice) and update as you suggested gradle. It worked then
Just chiming in here to add what worked / didn't work for me.
Flutter 3.24.2 + mapbox_maps_flutter 2.2.1 didn't build due to this error:
ERROR:/home/redacted/.gradle/caches/transforms-3/abe4cd01d4939bb9cb2e79505f114891/transformed/lifecycle-livedata-core-2.8.4-runtime.jar: R8: java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null
Upgrading AGP as others have suggested in this thread required several steps:
android
project in Android Studio, Tools -> AGP Upgrade Assistant)flutter_compass
by setting the subproject's namespace manually in android/build.gradle
based on this Stackoverflow thread.23.1.7779620
, so I had to override this in android/app/build.gradle
, replacing the line that previously contained ndkVersion flutter.ndkVersion
flutter_local_notifications
, which previously worked without changes to android/app/build.gradle
, now required explicitly enabling core library desugaringAfter all of this, it builds. But given that Flutter is firmly stuck on AGP 7.3.0, requiring these kinds of modifications seems really sketchy to me.
Hi all sorry for the trouble, we've fixed Android build issues in https://github.com/mapbox/mapbox-maps-flutter/pull/712 which should be available as a part of 2.3.0 release.
great!
After all of this, it builds. But given that Flutter is firmly stuck on AGP 7.3.0, requiring these kinds of modifications seems really sketchy to me.
@reiv Flutter SDK is generating Android projects with AGP 8.1.0 in the recent versions, 7.3.0 is probably the AGP version that was in use back when you had your project generated.
Closing this, feel free to reopen if you have any comments or questions.
I keep getting this error while trying to run the example application, Can someone help out
FAILURE: Build failed with an exception.
flutter doctor Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 3.24.0-1.0.pre.296, on macOS 14.5 23F79 darwin-arm64 (Rosetta), locale en-NG) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [!] Xcode - develop for iOS and macOS (Xcode 15.2) ✗ CocoaPods installed but not working. You appear to have CocoaPods installed but it is not working. This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it. This can usually be fixed by re-installing CocoaPods. For re-installation instructions, see https://guides.cocoapods.org/using/getting-started.html#installation [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] VS Code (version 1.91.1) [✓] Connected device (4 available) [✓] Network resources