代码之家  ›  专栏  ›  技术社区  ›  AgentP

Android Studio在下载kotlin-sdlib-1.3.71.pom时似乎卡住了

  •  0
  • AgentP  · 技术社区  · 6 年前

    我有一个单独使用java代码的android项目。但我想同时使用Kotlin和Java进行开发。

    所以我只是添加了一个 Kotlin 通过将类文件添加到我的项目中 New -> Kotlin File/ Class

    由于这是该项目首次向Kotlin公开,因此它自动向Gradle文件添加了一些依赖项,这是意料之中的。

    但现在我同步了我的项目,但下载时似乎android工作室卡住了 kotlin-stdlib-1.3.71.pom 现在差不多22分钟了

    Reference Image

    我有稳定的互联网连接,但似乎根本不完整

    供您参考:

    应用级build.gradle文件

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    
    android {
        compileSdkVersion 29
        buildToolsVersion '29.0.3'
        defaultConfig {
            applicationId "in.morningbell.app"
            minSdkVersion 19
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            vectorDrawables.useSupportLibrary = true
    
        }
    
        buildTypes {
            release {
                minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    
        buildFeatures{
            viewBinding = true
        }
    
    
    }
    
    dependencies {
    
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation "androidx.core:core-ktx:1.3.0"                    // added automatically actually it was ktx:+ i replaced it to 1.3.0
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72" // added automatically, it was jdk7:$kotlin_version I replaced version
    }
    repositories {
        mavenCentral()
    }
    

    项目级build.gradle文件

    buildscript {
        ext.kotlin_version = '1.3.72'
        repositories {
            google()
            jcenter()
            
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:4.0.0'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72"  // added automatically 
            // 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
    }
    

    我只是想知道Gradle的文件有什么问题吗?我很感激你的帮助

    非常感谢。

    0 回复  |  直到 6 年前
        1
  •  0
  •   AgentP    6 年前

    最后,我通过更改来消除了这个错误

     implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72"
    

    到

     implementation "org.jetbrains.kotlin:kotlin-stdlib:1.3.72"
    

    通过添加

    apply plugin: 'kotlin-android-extensions'
    

    到应用程序级别的顶部 build.gradle 文件

    推荐文章