Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapbox_maps_flutter does not work with Gradle 8.x #217

Open
penhorwood opened this issue Jul 29, 2023 · 8 comments
Open

Mapbox_maps_flutter does not work with Gradle 8.x #217

penhorwood opened this issue Jul 29, 2023 · 8 comments

Comments

@penhorwood
Copy link

I upgraded my project to Gradle 8 and my project stopped compiling on namespace and Kotlin issues. I fixed the namespace issue but I was never able to get the Mapbox code to compile until I downgraded back to Gradle 7.4.2

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.10.6, on Microsoft Windows [Version 10.0.19045.3208], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Android Studio (version 2022.3)
[√] Connected device (1 available)
[√] Network resources

@harrylenehan
Copy link

I get the same issue. Error is:

"A problem occurred configuring project ':mapbox_maps_flutter'.

Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
Namespace not specified. Specify a namespace in the module's build file. See https://d.android.com/r/tools/upgrade-assistant/set-namespace for information about setting the namespace."

@chikko80
Copy link

Facing the same issue -BUMP

@fleeser
Copy link

fleeser commented Dec 18, 2023

Any updates on this?

@lemonderon
Copy link

Most of the first-party flutter plugins (like package_info_plus, device_info_plus, connectivity_plus) now require the usage of Java 17, compileSDK 34 and Gradle 8.4.

Having a flutter app with mapbox_maps_flutter: 1.1.0 in pubspec and with the following build.gradle config

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    kotlin {
        jvmToolchain(17)
    }

results in

Execution failed for task ':mapbox_maps_flutter:compileDebugKotlin'.
> 'compileDebugJavaWithJavac' task (current target is 1.8) and 'compileDebugKotlin' task (current target is 17) jvm target compatibility should be set to the same Java version.

@evil159
Copy link
Contributor

evil159 commented Apr 23, 2024

Hi all, thank you for raising this, I've created an internal ticket to track this https://mapbox.atlassian.net/browse/MAPSFLT-204

@evil159 evil159 mentioned this issue Apr 30, 2024
3 tasks
@evil159
Copy link
Contributor

evil159 commented Apr 30, 2024

Gradle 8 compatibility should improve in #524

@gustavolramos
Copy link

Hi, I'm working with Mapbox 1.1.0, and a similar setup to @lemonderon, and achieve a similar error:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = '1.8'
    }

My error is:

Execution failed for task ':mapbox_maps_flutter:compileReleaseKotlin'.
> Inconsistent JVM-target compatibility detected for tasks 'compileReleaseJavaWithJavac' (1.8) and 'compileReleaseKotlin' (17).

This is my current Gradle android plugin:

classpath 'com.android.tools.build:gradle:8.3.2'

Also just for context my general Flutter Doctor -v:

[√] Flutter (Channel stable, 3.22.1, on Microsoft Windows [versÆo 10.0.19045.4412], locale pt-BR)
    • Flutter version 3.22.1 on channel stable at C:\Users\myUser\flutter   
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (4 days ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\myUser\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java     
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)      
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.4.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.4.33213.308
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2023.3)
    • Android Studio at C:\Program Files\Android\Android Studio1
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0--11572160)

[√] IntelliJ IDEA Community Edition (version 2022.2)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1.2
    • Flutter plugin version 71.0.5
    • Dart plugin version 222.4345.14

[√] VS Code (version 1.89.1)
    • VS Code at C:\Users\myUser\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.88.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [versÆo 10.0.19045.4412]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 125.0.6422.78
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 122.0.2365.92

[√] Network resources
    • All expected network resources are available.

My key setup is probably correct, since I've been extensively using the package for the last month, it definetly seems to be something with Gradle vs Mapbox specifically, since it still runs normally on IOS.

@lemonderon
Copy link

@gustavolramos You could try 2.0.0-rc.1 the latest build. They have fixed this issue, yet I encountered a new dealbreaker for me #552 which is specific for iOS builds. If I use 728fc8d commit from main branch directly I do not have the #552 and the gradle issues are gone for me for android builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants