【问题标题】:@nativescript-community/ui-mapbox : Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0@nativescript-community/ui-mapbox:找不到 com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0
【发布时间】:2022-07-06 13:49:13
【问题描述】:

我正在尝试在我的 nativesctipt 应用程序中使用 @nativescript-community/ui-mapbox 插件。

将插件添加到我的应用程序后

ns plugin add @nativescript-community/ui-mapbox
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:map="@nativescript-community/ui-mapbox" navigatingTo="navigatingTo">
  <StackLayout>
    <Label text="Nice map, huh!" class="title"/>
    <ContentView height="240" width="240">
      <map:MapboxView
          accessToken="your_token"
          mapStyle="traffic_night"
          latitude="52.3702160"
          longitude="4.8951680"
          zoomLevel="3"
          showUserLocation="true"
          mapReady="onMapReady">
      </map:MapboxView>
    </ContentView>
  </StackLayout>
</Page>

运行tns run android 命令时,出现以下错误:

Build file '/Users/Mac/lete/letesell/platforms/android/app/build.gradle' line: 575
A problem occurred configuring project ':app'.
Could not find com.mapbox.mapboxsdk:mapbox-android-accounts:0.7.0.
Required by:
    project :app
    project :app > com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0

【问题讨论】:

  • 这个运气好吗?我有同样的问题

标签: nativescript mapbox-gl


【解决方案1】:
  1. 生成具有下载:读取权限的令牌(请参阅detailed doc
  2. 将此添加到您的 App_Resources/Android/app.gradle 并将 DOWNLOAD_TOKEN 替换为您生成的:
repositories {
  maven {
    url 'https://api.mapbox.com/downloads/v2/releases/maven'
    authentication {
      basic(BasicAuthentication)
    }
    credentials {
      // Do not change the username below.
      // This should always be `mapbox` (not your username).
      username = "mapbox"
      // You can store secret token in gradle.properties for more security
      password = "DOWNLOAD_TOKEN"
    }
  }
}
  1. 在 App_Resources/Android/app.gradle 中将 minSdkVersion 更改为 21(或 the doc 所说的任何值)

【讨论】:

    猜你喜欢
    • 2023-04-03
    • 2021-10-26
    • 1970-01-01
    • 2021-12-04
    • 2013-12-15
    • 2018-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多