我有一个仅使用Java代码的android项目。但是我想同时使用Kotlin和Java进行开发。
所以我只是通过向我的项目中添加了Kotlin
类文件New -> Kotlin File/ Class
由于这是该项目第一次暴露给Kotlin,因此它会自动将一些依赖项添加到Gradle文件中。
但是现在我同步了我的项目,但是似乎android studio卡住了,而现在下载kotlin-stdlib-1.3.71.pom
差不多22分钟了
我的网络连接稳定,但似乎根本无法完成
供你引用 :
应用程序级别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文件有什么问题吗?我感谢您的帮助谢谢
最佳答案
最后,我通过更改摆脱了这个错误
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
文件的顶部
关于android-studio - 下载kotlin-stdlib-1.3.71.pom时,Android Studio似乎卡住了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62790532/