【问题标题】:Unable to compile Kotlin project with osmdroid 6.1.13无法使用 osmdroid 6.1.13 编译 Kotlin 项目
【发布时间】:2022-08-22 19:42:49
【问题描述】:

按照您的 Wiki (https://github.com/osmdroid/osmdroid/wiki/How-to-use-the-osmdroid-library-(Kotlin)) 上的教程在 Androidstudio 中创建 Kotlin 项目后,我无法编译该项目。我得到的错误信息:

FAILURE:构建完成,失败了 9 次。 1:任务因异常而失败。

What went wrong:
Execution failed for task \':app:dataBindingMergeDependencyArtifactsDebug\'.

Could not resolve all files for configuration \':app:debugCompileClasspath\'.
Could not find org.osmdroid:osmdroid-android\' ):6.1.13.
Required by:
project :app > org.osmdroid:osmdroid-wms:6.1.13
project :app > org.osmdroid:osmdroid-mapsforge:6.1.13

环境

Linux、Android Studio 2021.2.1 补丁 2、Gradle 插件 7.2.2、Gradle 版本 7.5.1

项目源代码可以在这里找到:https://gitlab.com/brmmm3/btmap

build.gradle 在应用程序

plugins {
    id \'com.android.application\'
    id \'org.jetbrains.kotlin.android\'
}

android {
    compileSdk 29

    defaultConfig {
        applicationId \"com.greatreset.btmap\"
        minSdk 29
        targetSdk 32
        versionCode 1
        versionName \"1.0\"

        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile(\'proguard-android-optimize.txt\'), \'proguard-rules.pro\'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = \'1.8\'
    }
    buildFeatures {
        viewBinding true
    }
    buildToolsVersion \'30.0.3\'
}

dependencies {
    implementation \'androidx.core:core-ktx:1.8.0\'
    implementation \'androidx.appcompat:appcompat:1.5.0\'
    implementation \'com.google.android.material:material:1.6.1\'
    implementation \'androidx.constraintlayout:constraintlayout:2.1.4\'
    implementation \'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1\'
    implementation \'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1\'
    implementation \'androidx.navigation:navigation-fragment-ktx:2.5.1\'
    implementation \'androidx.navigation:navigation-ui-ktx:2.5.1\'

    implementation \'org.osmdroid:osmdroid-android:6.1.13\'
    implementation \'org.osmdroid:osmdroid-wms:6.1.13\'
    implementation \'org.osmdroid:osmdroid-mapsforge:6.1.13\'
    implementation \'org.osmdroid:osmdroid-geopackage:6.1.13\'

    testImplementation \'junit:junit:4.13.2\'
    androidTestImplementation \'androidx.test.ext:junit:1.1.3\'
    androidTestImplementation \'androidx.test.espresso:espresso-core:3.4.0\'
}

gradle build 输出显示:

...
> Task :app:dataBindingMergeDependencyArtifactsDebug FAILED
Watching 24 directories to track changes
Resource missing. [HTTP GET: https://dl.google.com/dl/android/maven2/org/osmdroid/osmdroid-android\'%20)/6.1.13/osmdroid-android\'%20)-6.1.13.pom]
Resource missing. [HTTP GET: https://repo.maven.apache.org/maven2/org/osmdroid/osmdroid-android\'%20)/6.1.13/osmdroid-android\'%20)-6.1.13.pom]
:app:dataBindingMergeDependencyArtifactsDebug (Thread[Execution worker Thread 5,5,main]) completed. Took 0.219 secs.
Resolve mutations for :app:dataBindingMergeGenClassesDebug (Thread[included builds,5,main]) started.
Resolve mutations for :app:dataBindingMergeGenClassesDebug (Thread[included builds,5,main]) completed. Took 0.0 secs.
:app:dataBindingMergeGenClassesDebug (Thread[Execution worker Thread 2,5,main]) started.
...

可以看出,gradle正在将%20)添加到下载路径中。 gradle 从哪里得到这个?

  • 您可以通过 build.gradle 中的 osmdroid 实现来更新您的问题吗?
  • github.com/osmdroid/osmdroid/issues/1831 是您的问题报告吗?好吧,我们必须等待 OsmDroid 维护者响应

标签: android android-studio kotlin osmdroid


【解决方案1】:

发现 wms 和 mapsforge 的 pom 文件对于 6.1.13 和 6.1.12 版本有问题。讨论可以在这里找到:https://github.com/osmdroid/osmdroid/issues/1831 同时使用 6.1.11 解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-02
    • 1970-01-01
    • 2012-11-08
    • 2018-04-19
    • 2018-04-14
    • 2020-12-12
    • 1970-01-01
    • 2021-10-27
    相关资源
    最近更新 更多