java - 无法进行导航抽屉活动
问题描述
我创建了一个新闻应用程序,我想在其中使用导航抽屉,但是当我添加导航抽屉活动时,它会出现一些错误。即使我使用导航抽屉属性创建一个新项目,它仍然会出错。我创建了一个新闻应用程序,我想在其中使用导航抽屉,但是当我添加导航抽屉活动时,它会出现一些错误。即使我使用导航抽屉属性创建一个新项目,它仍然会出错。
> Task :prepareKotlinBuildScriptModel UP-TO-DATE
Warning: Failed to parse host Vitika
Warning: Failed to parse host Vitika
Failed to parse host Vitika
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings
Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk16:1.3.72.
Show Details
Affected Modules: app
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk16:1.3.72.
Show Details
Affected Modules: app
Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk16:1.3.72.
Show Details
Affected Modules: app
Build.gradle(项目:新闻)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.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
}
构建.gradle(模块:应用程序)
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.vitika.news"
minSdkVersion 21
targetSdkVersion 30
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'
}
buildFeatures {
//noinspection DataBindingWithoutKapt
dataBinding true
}
repositories{
maven{ url 'http://repo1.maven.org/maven2'}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk16:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
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.android.volley:volley:1.2.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
implementation "androidx.browser:browser:1.3.0"
def fragment_version = "1.3.3"
// Java language implementation
implementation "androidx.fragment:fragment:$fragment_version"
// Kotlin
implementation "androidx.fragment:fragment-ktx:$fragment_version"
def nav_version = "2.3.5"
// Java language implementation
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
// Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:1.0.0-alpha10"
implementation 'com.google.android.material:material:1.3.0'
}
gradle.properties
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Wed May 19 16:22:21 IST 2021
systemProp.https.proxyHost=Vitika
systemProp.https.proxyPort=8080
解决方案
可用的 jdk 是 jdk8 或 jdk7 而不是 jdk16。
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
推荐阅读
- javascript - Ajax 帖子在 Firefox 中不工作,但在 chrome 中工作
- css - 如何制作 Angular Material Card Title 一个衬垫?
- php - 如何在 PHP 中显示用户名而不是登录 ID?
- django - Django Admin Form DateTime 字段,以用户系统时间显示,但另存为 UTC
- arrays - 表示要在 VBA 中的字符串数组中搜索的负值
- html - HTML Canvas 无法在移动设备上播放
- php - 如何在 laravel 中对 2 个关系使用查询
- angular - 在 Ionic 中生成 OpenLayers 地图作为组件
- reactjs - 在 create-react-app 中运行“npm test”时如何忽略某些文件?
- batch-file - 在批处理脚本中解析特定文件夹中的大量 .xml 文件时丢弃一组特定的 .xml 文件