android - 不再支持源选项 5。在 android studio 中使用 6 或更高版本
问题描述
我正在尝试在我的 Windows 机器上构建一个 android 应用程序。构建时低于错误。自 2 个月以来我一直在研究我的 android 项目,但现在我收到错误我正在使用 android studio 4.2.1,而我试图构建 apk 它给出了错误我不知道如何使用 mavenCentral() 请帮助
Source option 5 is no longer supported. Use 6 or later.
我最近在 build.gradle 中添加了 mavenCentral()
allprojects {
repositories {
google()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon (
// i replaced jcenter() to mavenCentral()
}
}
其他 Gradle 文件代码是这个
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.myshop"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
viewBinding true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-
rules.pro'
}
}
compileOptions {
sourceCompatibility kotlin_version
targetCompatibility kotlin_version
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-firestore:23.0.0'
implementation 'com.google.firebase:firebase-storage:20.0.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation platform('com.google.firebase:firebase-bom:26.5.0')
implementation 'com.google.firebase:firebase-analytics-ktx:19.0.0'
implementation 'com.google.android.material:material:1.3.0'
// glide
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
//Adding coroutines to a project
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.2"
}
解决方案
推荐阅读
- python - ValueError:磁带仍在录制,如果您尝试重新输入已经激活的磁带,可能会发生这种情况
- linux - 如何进入 Xilinx ZCU102 u-boot 提示符
- html - 使用 h5p-standalone 插件放置 H5P 文件的位置
- java - 获取 Firebase 存储上图像的 URL
- json - 如何使用 JQ 合并和重塑嵌套对象?
- spring-boot - 在 Spring Boot 中使用 apache cxf 在生产者端公开的用于休息 api 的 Spring Cloud 合约
- c# - 如何扩展 asp.net 样板中的设置
- spring-boot - 在本地主机中运行 springboot 应用程序时出错
- json - 使用逻辑应用分解 Log Analytics 查询结果
- javascript - 无法将 Active 类添加到反应映射功能中的组列表项