【问题标题】:why osmdroid.jar file implentation in android studio throws error?为什么 android studio 中的 osmdroid.jar 文件实现会引发错误?
【发布时间】:2015-04-24 17:20:43
【问题描述】:

我正在尝试在 android studio 中使用 Osmdroid linkfor 离线地图,当我尝试在 xml 中使用它时,它会抛出错误,因为我第一次使用它时我想不出找出我做错的地方,请让我错误:序言中不允许内容。

:app:mergeDebugResources FAILED
/Users/Avi/AndroidStudioProjects/MyApplication/app/src/main/res/Library/osmdroid_android.jar
Error:Error: Content is not allowed in prolog.
Error:Execution failed for task ':app:mergeDebugResources'.> /Users/Avi/AndroidStudioProjects/MyApplication/app/src/main/res/Library/osmdroid_android.jar:0:0: Error: Content is not allowed in prolog.know how to solve this

已解决 感谢 Morrison Chang,如果您像我一样使用 android studio,只需将依赖项放入,无需导入 .jar 文件

compile 'org.osmdroid:osmdroid-android:4.2'
compile 'org.slf4j:slf4j-simple:1.6.1'

【问题讨论】:

  • 你如何将它添加到你的项目中。如果你使用的是 AndroidStudio/Gradle - 你见过吗:github.com/osmdroid/osmdroid/wiki/…
  • 我正在添加它,就像在 wiki 中提到的那样,即将 .jar 文件粘贴到项目 add as library 中,并在清单中授予权限,并在构建中添加 compile persion 。毕业文件

标签: java android dictionary osmdroid offlineapps


【解决方案1】:

正如@MorrisonChang 所说,您需要添加How to add the osmdroid library via Gradle 中提供的gradle 依赖项,其中说:

如果您使用 Gradle,则必须将以下依赖项添加到您的 build.gradle 文件:

dependencies {
    compile 'org.osmdroid:osmdroid-android:4.2'
    compile 'org.slf4j:slf4j-simple:1.6.1'
}

【讨论】:

  • @Virus 如果这个或任何答案已经解决了您的问题,请点击复选标记考虑accepting it。这向更广泛的社区表明您已经找到了解决方案,并为回答者和您自己提供了一些声誉。没有义务这样做。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-12-09
  • 2019-04-19
  • 2015-09-02
  • 1970-01-01
相关资源
最近更新 更多