Android的工作室 - 找不到org.jetbrains.kotlin:科特林-STDLIB:1.1.3-2

问题描述 投票:1回答:2

我试图编译我的Android Studio中(使用Java)项目,并出现以下错误:

Could not find org.jetbrains.kotlin:kotlin-stdlib:1.1.3-2.
Searched in the following locations:
  - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom
  - https://maven.fabric.io/public/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar
  - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.pom
  - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.1.3-2/kotlin-stdlib-1.1.3-2.jar

因为我没有使用科特林我不明白的是被请求编译我的项目为什么。

在这里我看到关于它的问题,其余的都是关于科特林项目或失踪SDK,但它不是我的情况。

的build.gradle(APP):

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
        google()
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.27.1'
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.project.test"
        minSdkVersion 22
        targetSdkVersion 27
        versionCode 10
        versionName "0.19"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),     'proguard-rules.pro'
        }
    }
    dataBinding.enabled = true
    testOptions {
        unitTests.all {
            jvmArgs '-XX:MaxPermSize=256m'
        }
        unitTests.returnDefaultValues = true
    }
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.json:json:20180130'
    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:27.1.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.github.paolorotolo:expandableheightlistview:1.0.0'
    implementation 'com.google.code.gson:gson:2.8.5'
    def room_version = "1.1.1"

    implementation "android.arch.persistence.room:runtime:$room_version"
    annotationProcessor "android.arch.persistence.room:compiler:$room_version"
    // optional - RxJava support for Room
    implementation "android.arch.persistence.room:rxjava2:$room_version"
    // optional - Guava support for Room, including Optional and ListenableFuture
    //implementation "android.arch.persistence.room:guava:$room_version"

    // Converter
    implementation "android.arch.persistence.room:runtime:1.1.1"
    annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
    implementation 'com.google.code.gson:gson:2.8.5'

    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'

    testImplementation "org.powermock:powermock-module-junit4:1.7.4"
    testImplementation "org.powermock:powermock-api-mockito2:1.7.4"

    // WorkManager
    implementation "android.arch.work:work-runtime:1.0.0-beta02"

    // Power menu
    implementation "com.github.skydoves:powermenu:2.0.5"

    // Crashlytics
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true
    }
}

的build.gradle(项目):

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}
allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

dependencies {
}

先感谢您。

android android-studio kotlin android-gradle
2个回答
2
投票

从您的应用程序模块buildscript取出build.gradle块。它覆盖任何顶级build.gradle提供,它缺少jcenter回购,其中科特林是。


0
投票

于是,我找到了解决办法。我还在做一些研究,我发现这个问题:possible solution

人们说jcenter()必须包含在项目级的build.gradle,因为我已经有了它,我试图将它添加到的build.gradle(应用程序)。

有效。

如果有人可以解释为什么,这将是真棒。

© www.soinside.com 2019 - 2024. All rights reserved.