首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >通过Android添加osmdroid库(Gradle)

通过Android添加osmdroid库(Gradle)
EN

Stack Overflow用户
提问于 2020-03-24 19:03:03
回答 1查看 1.9K关注 0票数 1

我对移动开发非常陌生,并且尝试开发一个简单的android应用程序。对于我的项目,我需要OSM (开放的街道地图或更准确的osmdroid。我试着遵循以下说明:https://github.com/osmdroid/osmdroid/wiki/How-to-add-the-osmdroid-library-via-Gradle,但不幸的是,这对我没有用。我想我把密码插错地方了。

那就是它现在的位置。下面是"build.gradle (:app)“中的代码:

代码语言:javascript
复制
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'

    implementation 'org.osmdroid:osmdroid-android:(6.1.6)'
    implementation 'org.osmdroid:osmdroid-wms:(6.1.6)'
    implementation 'org.osmdroid:osmdroid-mapsforge:(6.1.6)'
    implementation 'org.osmdroid:osmdroid-geopackage:(6.1.6)'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}

如果我试图同步,这是错误消息:

代码语言:javascript
复制
FAILURE: Build failed with an exception.

 * What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
   > Could not find org.osmdroid:osmdroid-android:(6.1.6).
     Required by:
         project :app
   > Could not find org.osmdroid:osmdroid-wms:(6.1.6).
     Required by:
         project :app
   > Could not find org.osmdroid:osmdroid-mapsforge:(6.1.6).
     Required by:
         project :app
   > Could not find org.osmdroid:osmdroid-geopackage:(6.1.6).
     Required by:
         project :app

 * 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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-03-24 19:21:30

您应该删除库版本中的括号,而不是这样。

代码语言:javascript
复制
implementation 'org.osmdroid:osmdroid-android:(6.1.6)'
implementation 'org.osmdroid:osmdroid-wms:(6.1.6)'
implementation 'org.osmdroid:osmdroid-mapsforge:(6.1.6)'
implementation 'org.osmdroid:osmdroid-geopackage:(6.1.6)'

写这个

代码语言:javascript
复制
implementation 'org.osmdroid:osmdroid-android:6.1.6'
implementation 'org.osmdroid:osmdroid-wms:6.1.6'
implementation 'org.osmdroid:osmdroid-mapsforge:6.1.6'
implementation 'org.osmdroid:osmdroid-geopackage:6.1.6'
票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60837631

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档