Skip to content

Commit

Permalink
[android] Make build work with instructions in docs (#698)
Browse files Browse the repository at this point in the history
`build.gradle` currently does not respect the `MAPBOX_DOWNLOADS_TOKEN`
project property as subbested by the official docs for Android at
https://docs.mapbox.com/android/maps/guides/install/.

This approach does not interfere with the `SDK_REGISTRY_TOKEN`
environment variable used for CI, but just uses the official approach as
a fallback.

Also updated docs
  • Loading branch information
shroff authored Oct 15, 2021
1 parent 08795e0 commit c1a6919
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,27 @@ An alternative method to provide access tokens that was required until the v0.7

### SDK Download token

You must also [configure a secret access token having the Download: read
scope][https://docs.mapbox.com/ios/maps/guides/install/]. If this configuration
is not present, an error like the following appears during the iOS build.
You must also configure a secret access token having the *Download: read* scope for
(Android)[https://docs.mapbox.com/android/maps/guides/install/] and/or
(iOS)[https://docs.mapbox.com/ios/maps/guides/install/].

If this configuration is not present, an error like the following appears during
the build process:

#### Android
```
* What went wrong:
A problem occurred evaluating project ':mapbox_gl'.
> SDK Registry token is null. See README.md for more information.
```

#### iOS
```
[!] Error installing Mapbox-iOS-SDK
curl: (22) The requested URL returned error: 401 Unauthorized
```


## Avoid Android UnsatisfiedLinkError

Update buildTypes in `android\app\build.gradle`
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
}

rootProject.allprojects {
def token = System.getenv('SDK_REGISTRY_TOKEN')
def token = System.getenv('SDK_REGISTRY_TOKEN') ?: project.properties['MAPBOX_DOWNLOAD_TOKEN']
if (token == null || token.empty) {
throw new Exception("SDK Registry token is null. See README.md for more information.")
}
Expand Down

0 comments on commit c1a6919

Please sign in to comment.