ui-mapbox icon indicating copy to clipboard operation
ui-mapbox copied to clipboard

Error on latest version

Open guillemc23 opened this issue 1 year ago • 8 comments

Hey! I just updated this plugin to the latest version v6.2.21 and I got the following error:

System.err: An uncaught Exception occurred on "main" thread.
  System.err: Calling js method run failed
  System.err: Error: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapbox/android/accounts/v1/MapboxAccounts;

I'm not sure what could be causing it so I'll just report it and roll back to 6.2.19 for the moment.

guillemc23 avatar Nov 19 '23 01:11 guillemc23

@guillemc23 I think it is because I enforce an older version of mapbox. it is necessary for people not wanting to use latest mapbox SDK for which you need an apu key. you can still enforce a newer version (in which the account thing appeared). you can set the versions of all those https://github.com/nativescript-community/ui-mapbox/blob/master/packages/ui-mapbox/platforms/android/include.gradle#L7 in before-plugins.gradle as explained here https://v6.docs.nativescript.org/core-concepts/android-runtime/advanced-topics/gradle-hooks

farfromrefug avatar Nov 19 '23 12:11 farfromrefug

@farfromrefug I'm not sure if I follow. I'm not enforcing any mapbox version, so I guess it's taking the default one? Also, if I don't add my token, the map won't load, how is it possible to use it without token? I don't need to do much with Mapbox, but I only updated it to check for compatibility with the latest @nativescript/geolocation

guillemc23 avatar Nov 28 '23 02:11 guillemc23

I am trying to enforce a newer version of Mapbox in my project; I have added the latest version to my before-plugins.gradle as in:

    project.ext { 
        mapboxVersion = "10.16.2"   
    }

But according to the Mapbox docs, the newer versions require to add a new maven repo with authentication somewhere. I have set up properly my token but I'm still unable to download the latest SDK. I have tried adding the repository directly into the plugin's include.gradle but it's returning this error when building:

Build file '/Users/Guille/Desktop/NS/TestApp/platforms/android/app/build.gradle' line: 589
A problem occurred configuring project ':app'.
Could not find com.mapbox.mapboxsdk:mapbox-android-sdk:10.16.2.
Required by:
    project :app

The latest available in maven is 9.2.1, which still returns the same errors as before.

guillemc23 avatar Nov 29 '23 15:11 guillemc23

Are there any plans on supporting something like Maplibre? It's a fork of mapbox from the days it was OSS. https://github.com/maplibre/maplibre-native#maplibre-native

This project originated as a fork of Mapbox GL Native, before their switch to a non-OSS license in December 2020.

CatchABus avatar Nov 30 '23 01:11 CatchABus

@CatchABus yes I mention it multiple times that this should be the future. but I won't do it. i will mostly never use maplibre as I much prefer another oss map framework ;)

farfromrefug avatar Nov 30 '23 06:11 farfromrefug

I see a different error at build time, but it looks to be caused by the same issue.

I'm not specifying any mapbox version (so it should use 8.6.6), but when I run nativescript build android, then I see:

Build file '[..omitted..]/platforms/android/app/build.gradle' line: 589
A problem occurred configuring project ':app'.
Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
Required by:
    project :app > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0

Command ./gradlew failed with exit code 1

This is happening because com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0 depends on com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0.

I don't understand how to use before-plugins.gradle to make this work, even versions 8.6.6 and lower depend on mapbox-android-accounts.

notclive avatar Dec 05 '23 11:12 notclive

Once I add the credentials block to app.gradle (and specify a MAPBOX_DOWNLOADS_TOKEN) the above errors go away.

notclive avatar Dec 05 '23 11:12 notclive

@notclive thanks indeed it is needed with latest mapbox. though not sure why it wasn't using 8.6.6 in your case. will have to check might be a transitive dependency

farfromrefug avatar Dec 05 '23 19:12 farfromrefug