Open MilesAdamson opened 11 months ago
I've narrowed down the issue a bit. In the build.grade file of the plugin, if I change the token lookup from:
rootProject.allprojects {
def token = System.getenv("SDK_REGISTRY_TOKEN")
if (token == null || token.empty) {
throw new Exception("SDK Registry token is null. See README.md for more information.")
}
to hard coding my token:
rootProject.allprojects {
def token = "(my token hard coded here)"
It does build along with other changes to packagingOptions
it did build. But it's not maintainable to edit that file all the time. Not sure what the issue actually is specifically still
have you resolved this issue?
No, did you have a similar issue?
Having the same problem.
hey there, I encountered this issue as well on brand new build with the most up-to-date flutter version running on my mac(intel). If needed I could provide a working example
steps:
dependencies {
implementation 'com.mapbox.maps:android:11.0.0'
}
...
maven { url = uri("https://api.mapbox.com/downloads/v2/releases/maven") // Do not change the username below. It should always be "mapbox" (not your username). credentials.username = "mapbox" // Use the secret token stored in gradle.properties as the password credentials.password = providers.gradleProperty("MAPBOX_DOWNLOADS_TOKEN").get() authentication { basic(BasicAuthentication) } }
4. add pub dependency
mapbox_maps_flutter: ^0.5.1
5. flutter run
6. add map widget
#output
FAILURE: Build completed with 2 failures.
**_1: Task failed with an exception.
-----------
* Where:
Build file '/Users/macbook/.pub-cache/hosted/pub.dev/mapbox_maps_flutter-0.5.1/android/build.gradle' line: 21
* What went wrong:
A problem occurred evaluating project ':mapbox_maps_flutter'.
> SDK Registry token is null. See README.md for more information.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':mapbox_maps_flutter'.
> Failed to notify project evaluation listener.
> Could not get unknown property 'android' for project ':mapbox_maps_flutter' of type org.gradle.api.Project.
> Could not find method implementation() for arguments [project ':flutter_plugin_android_lifecycle'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
> Could not get unknown property 'android' for project ':mapbox_maps_flutter' of type org.gradle.api.Project.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================_**
For me, the answer was just to set SDK_REGISTRY_TOKEN
with the private mapbox token in my gradle.properties
file
In my case i followed the documentation and provided my secret key as MAPBOX_DOWNLOADS_TOKEN in gradle.property, I changed it with SDK_REGISTRY_TOKEN and the issue is resolved.
I don't know if it can help. But even if I created ~/.gradle/gradle.properties with SDK_REGISTRY_TOKEN=sk.... , I had always this bug when I tried to compile my app for Android platform. I remove Android folder from my flutter project and after I create a new one with the command flutter create --platforms=android .
and I compile and it works fine now.
Just one thing, don't forget to save your manifest.xml because after the command below, you'll have a new manifest.xml and you have to set up again every permissions,... 🥲
May be I had this bug, because one time Android Studio asks me for updating my Android project ( Android part of my flutter project) with AGP Upgrade Assistant and I said yes and some updates had created some conflicts with Flutter build.
In my case i followed the documentation and provided my secret key as MAPBOX_DOWNLOADS_TOKEN in gradle.property, I changed it with SDK_REGISTRY_TOKEN and the issue is resolved.
As well as in this line: credentials.password = providers.gradleProperty("MAPBOX_DOWNLOADS_TOKEN").get() to credentials.password = providers.gradleProperty("SDK_REGISTRY_TOKEN").get()
I have an existing project I am trying to migrate from google maps to mapbox. When I add
mapbox_maps_flutter: ^0.5.0
to my pubspec, andSDK_REGISTRY_TOKEN
to mygradle.properties
then try to build, I get the error below.The issue does not appear to be with other dependencies. I can make a brand new flutter project, and build successfully if I copy+paste all the dependencies in from my real project. Any help would be appreciated, I'm not even really sure if this is an issue with this plugin.
My dependencies: