'Android Studio Navigation Safeargs: com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable - Error
just started working in Android Studio and trying to add the navigation safeargs, when this error occurred: com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
No idea what I did. Here are my build.gradle files:
plugins {
id 'com.android.application'
id 'androidx.navigation.safeargs'
}
[...]
android {
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
buildscript {
repositories {
google()
}
dependencies {
def nav_version = "2.4.2"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" }
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.navigation:navigation-fragment:2.4.2'
implementation 'androidx.navigation:navigation-ui:2.4.2'
implementation 'androidx.navigation.safeargs:androidx.navigation.safeargs.gradle.plugin:2.4.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
and
// Top-level build file where you can add configuration options common to all sub-projects/modules.
// no idea but this block seems to be also in this file?
buildscript {
repositories {
google()
}
dependencies {
def nav_version = "2.4.2"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" }
}
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The plugin androidx.navigation.safeargs just worked, after adding the
repositories {
google()
}
dependencies {
def nav_version = "2.4.2"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" }
}
additionally to the top-level build.gradle-file. Originally this code was generated in the module part. Could this be somehow part of the error?
So far I tried Tutorials like:https://developer.android.com/guide/navigation/navigation-pass-data#java and https://developer.android.com/jetpack/androidx/releases/navigation#groovy
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
