无法解析 org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.5.1

Posted

技术标签:

【中文标题】无法解析 org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.5.1【英文标题】:Could not resolve org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.5.1 【发布时间】:2021-10-09 21:05:32 【问题描述】:

我的 android 项目有一些问题,当我尝试将项目与 Gradle 文件同步时,控制台日志显示此错误


* What went wrong:
A problem occurred configuring root project 'GlobalApp'.
> Could not resolve all artifacts for configuration ':classpath.
   > Could not resolve org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.5.1.
     Required by:
         project :
      > Could not resolve org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.5.1.
         > Could not get resource 'https://kotlin.bintray.com/kotlinx/org/jetbrains/kotlinx/kotlinx-gradle-serialization-plugin/0.5.1/kotlinx-gradle-serialization-plugin-0.5.1.pom'.
            > Could not GET 'https://kotlin.bintray.com/kotlinx/org/jetbrains/kotlinx/kotlinx-gradle-serialization-plugin/0.5.1/kotlinx-gradle-serialization-plugin-0.5.1.pom'. Received status code 403 from server: Forbidden

实际上,当我尝试加载 de URL 时,https://kotlin.bintray.com/kotlinx/org/jetbrains/kotlinx/kotlinx-gradle-serialization-plugin/0.5.1/kotlinx-gradle-serialization-plugin-0.5.1.pom 的响应是 403

我不知道是否存在另一个存储库或如何解决此问题?

它们是我的 build.gradle 文件


buildscript 
    ext.kotlin_version = '1.2.51'
    ext.serialization_version = '0.5.1'
    repositories 
        google()
        mavenCentral()
        maven  url "https://kotlin.bintray.com/kotlinx" 
    
    dependencies 
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:$serialization_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    


allprojects 
    repositories 
        google()
        mavenCentral()
    


task clean(type: Delete) 
    delete rootProject.buildDir

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'

android 
    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig 
        applicationId "com.sisvol.app.globalappkcr"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName '2.39.0'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        setProperty("archivesBaseName", "GlobalApp-JSM-ST8050B-$versionName")
    
    buildTypes 
        release 
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        
    



compileKotlin 
    kotlinOptions.jvmTarget = "1.8"

compileTestKotlin 
    kotlinOptions.jvmTarget = "1.8"


dependencies 
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version"
    //implementation 'com.google.code.gson:gson:2.8.5'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:exifinterface:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation files('libs/core-3.2.1.jar')
    implementation files('libs/top-usdk-service-1.0.2.jar')

 ``


【问题讨论】:

您找到解决方案了吗? 【参考方案1】:
buildscript 
ext.kotlin_version = '1.2.51'
ext.serialization_version = '0.5.1'
repositories 
    google()
    mavenCentral()
    maven  url "https://dl.bintray.com/kotlin/kotlinx/" 

修改maven的url为:https://dl.bintray.com/kotlin/kotlinx/

【讨论】:

以上是关于无法解析 org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:0.5.1的主要内容,如果未能解决你的问题,请参考以下文章

无法解析 org.jetbrains:kotlin-css-jvm:1.0.0-pre.31-kotlin-1.2.41

Kotlin gradle 无法初始化类 org.jetbrains.kotlin.gradle.internal.KotlinSourceSetProviderImplKt

无法修复:找不到 kotlin-reflect-1.3.72.jar (org.jetbrains.kotlin:kotlin-reflect:1.3.72)

libGDX与Kotlin错误“org.jetbrains.kotlin.kapt.idea.KaptModelBuilderService”

执行 org.jetbrains.kotlin 时缺少必需的类

“kotlin-android”和“org.jetbrains.kotlin.android”是一样的吗?