[英]Unable to start activity ComponentInfo with Mainactivity and Navigation drawer?
[英]Unable to make navigation drawer activity
我创建了一个新闻应用程序,我想在其中使用导航抽屉,但是当我添加导航抽屉活动时,它会出现一些错误。即使我创建了一个具有导航抽屉属性的新项目,它仍然会出错。 我创建了一个新闻应用程序,我想在其中使用导航抽屉,但是当我添加导航抽屉活动时,它会出现一些错误。即使我创建了一个具有导航抽屉属性的新项目,它仍然会出错。
> 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"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.