[英]Cannot resolve symbol 'EnableJpaRespositories' even though specified in build.gradle
[英]compileSdkVersion is not specified. Please add it to build.gradle: even though I have it defined in my build.gradle file
我嘗試添加 openweather api,當我嘗試同步build.gradle
文件時彈出此錯誤
未指定 compileSdkVersion。 請加到build.gradle
我的文件:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.myapplication'
compileSdk 33
defaultConfig {
applicationId "com.example.myapplication"
minSdk 24
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
我已經定義了 CompileSDK,所以我不知道為什么它仍然會彈出。
此錯誤定義您沒有提到compileSdkVersion而不是compileSdk 。 雖然兩者的意思相同,但如果您遇到此問題,請在 build.gradle 文件中提及compileSdkVersion
。
此問題與 7.0.0 中新的 gradle 更改有關,因此您可以將compileSdkVersion與字符串和 int 值一起使用,如下所示。
android {
compileSdkVersion = "S"
//or with same number version
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.