Closed Stophface closed 3 years ago
Hi ! Add the following code to your repositories in build.gradle:
@Alaa-Ben Thanks. What is the MAPBOX_DOWNLOAD_TOKEN
?
The one Access-Token I generate on mapbox.com for a project?
You could use that one, or create another. The important thing is that the token must have access to the DOWNLOADS API.
@Alaa-Ben That is not doing the trick. I get
Could not HEAD 'https://api.mapbox.com/downloads/v2/releases/maven/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom'. Received status code 401 from server: Unauthorized
The token I used has evey box checked (just for the sake of it)...
Under credentials
it says
credentials {
...
// Use the secret token you stored in gradle.properties as the password
password = project.properties[''] ?: ""
}
Use the secret token you stored in gradle.properties as the password
Where is gradle.properties
? It does not sound like I need an access token here...
I don't think you're using the token correctly. gradle.properties is a file in your android folder that allows to access properties in your gradle files. If you don't have one, either create one and add you token there. Example:
FLIPPER_VERSION=0.96.1
MAPBOX_DOWNLOADS_TOKEN=MY_TOKEN_KEY
VERSION_CODE=100000
VERSION_NAME =1.0.0
...
then access it with the same name used in this file:
credentials {
...
// Use the secret token you stored in gradle.properties as the password
password = project.properties[''MAPBOX_DOWNLOADS_TOKEN"] ?: ""
}
Or just directly put your token in your credentials:
credentials {
...
// Use the secret token you stored in gradle.properties as the password
password = "TOKEN_KEY"
}
@Alaa-Ben Ah yes, I did not set the token correctly. I used
project.properties[''MAPBOX_DOWNLOADS_TOKEN"] ?: ""
eventhough I hardcoded the token into [''MAPBOX_DOWNLOADS_TOKEN"]
. I should have used password = "TOKEN_KEY"
instead and not referencing project.properties
... Now its in gradle.properties
and referencing it with project.properties
works.
Thank you so much for sticking with me! I still wonder why I have to do this though. The installation guide only mentions this, when I want to install a custom version of Mapbox, which I do not want to do...
My pleasure :) I believe that until this repo updates its internal fetching, it is needed to manually tell which maven link to use.
Alright... Thank you @Alaa-Ben !
Had this problem today, and this fixed it: https://github.com/react-native-mapbox-gl/maps/issues/1572
Is there any other possibly working solution? I have almost 2 exact project, but in one there is the error occuring: > Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0. and in the other one the whole solution works perfectly, without any need of tweaking or anything else.
I tried even adding jcenter() (fromm issue #1572), but it did not work at all. I am using Jetpack Compose in both projects.
Platform: [Android]
Platform OS: [Android 11]
Device: [OnePlus 8 Pro]
Emulator/ Simulator: [no]
Dev OS: [Ubuntu 18.04.6 LTS]
Android SDK
Is there any other possibly working solution? I have almost 2 exact project, but in one there is the error occuring: > Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0. and in the other one the whole solution works perfectly, without any need of tweaking or anything else.
I tried even adding jcenter() (fromm issue #1572), but it did not work at all. I am using Jetpack Compose in both projects.
Platform: [Android] Platform OS: [Android 11] Device: [OnePlus 8 Pro] Emulator/ Simulator: [no] Dev OS: [Ubuntu 18.04.6 LTS] Android SDK
This should solely be an issue of finding the correct repository for the dependencies. jcenter should work - maybe check the order in which you list the repos?
Be aware though ! Jcenter is deprecated, so the workaround in the mentioned issue isn't a viable/durable solution. You should tell your app where to fetch the maven assets. Have you tried my solution above ?
Be aware though ! Jcenter is deprecated, so the workaround in the mentioned issue isn't a viable/durable solution. You should tell your app where to fetch the maven assets. Have you tried my solution above ?
@Alaa-Ben, jcenter limitations were mentioned in the other issue.
This is a multifaceted issue, as there are various dependencies with many versions that are deposited in different repositories.
Newer dependencies require tokens and are located via url setup on maven
, while older are somewhere on mavenCentral
while others are still available on jcenter
..... 🤯
You could use that one, or create another. The important thing is that the token must have access to the DOWNLOADS API.
where can i get your TOKEN_KEY.
Describe the bug
I set up a fresh react-native project and added Mapbox with
yarn add @react-native-mapbox-gl/maps
. Thisis not applicable as far as I understand, because I am aiming at API 29 on Android.
I added the democode provided
and started the App on Android. I get the following this error:
To Reproduce
This is
app/android/build.gradle
Expected behavior
I expect the app to compile and start.
Actual behavior
It is not compiling but giving me this error:
1: Task failed with an exception.
What went wrong: Execution failed for task ':app:mergeDebugAssets'.
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: Execution failed for task ':app:checkDebugAarMetadata'.
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.
3: Task failed with an exception.
What went wrong: Execution failed for task ':app:processDebugMainManifest'.
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.
4: Task failed with an exception.
What went wrong: Execution failed for task ':react-native-mapbox-gl_maps:generateDebugRFile'.
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.
5: Task failed with an exception.
What went wrong: Execution failed for task ':app:mergeDebugJavaResource'.
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.
6: Task failed with an exception.
What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.
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.
7: Task failed with an exception.
What went wrong: Execution failed for task ':app:desugarDebugFileDependencies'.
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.
8: Task failed with an exception.
What went wrong: Execution failed for task ':app:mergeDebugNativeLibs'.
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.
Get more help at https://help.gradle.org
Versions
When I click on the link provided https://repo.maven.apache.org/maven2/com/mapbox/mapboxsdk/mapbox-android-accounts/0.7.0/mapbox-android-accounts-0.7.0.pom
I get a 404...