【发布时间】:2020-08-04 19:43:26
【问题描述】:
我已将我的 android studio 升级到 3.6.3 并下载 gradles 但 当我启动一个 kotlin 语言项目时,在运行时会出错:
ERROR: Module 'app': platform 'android-28' not found.
还有我的 build.gradle:
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-
plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they
// belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
和 build.gradle(app) :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.kotlinapp5"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-
optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-
jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-
core:3.2.0'
}
我曾尝试更改谷歌的服务,但没有任何改变。
编辑
这是我的sdk经理sdk manager
当我降级 sdk 版本时,它会发生: error image
还有我的 gradle 版本:gradles version
和午餐活动:lunch
还有我的 sdk 工具:sdk tools
【问题讨论】:
-
在 SDK 管理器的“SDK 平台”选项卡中,确保您已下载 API Level 28 SDK。
-
我将它更改为我拥有的 24 sdk 版本,但它警告另一个错误,请检查我的编辑
标签: android android-studio kotlin gradle android-gradle-plugin