Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01
Asked Answered
O

9

24

I want to use Navigation Architecture Components.

But I got a problem with importing safeargs

Sync message:

Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01. Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.pom
https://dl.google.com/dl/android/maven2/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.jar
https://jcenter.bintray.com/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.pom
https://jcenter.bintray.com/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.jar
Required by:
project :

I followed Adding Components to your Project but does not solved my problem.

Project: build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01"

        // 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
}

Module: build.gradle

apply plugin: 'com.android.application'
apply plugin: 'androidx.navigation.safeargs'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.mangoslab.navigation"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    def nav_version = "1.0.0-alpha01"

    implementation "android.arch.navigation:navigation-fragment:${nav_version}" // use -ktx for Kotlin
    implementation "android.arch.navigation:navigation-ui:${nav_version}" // use -ktx for Kotlin

    // optional - Test helpers
    androidTestImplementation "android.arch.navigation:navigation-testing:${nav_version}" // use -ktx for Kotlin
}
Ought answered 11/5, 2018 at 2:57 Comment(1)
I have the same problem, it’s a bug on their side. Issue is tracked here issuetracker.google.com/issues/79454383Tempting
C
35

Try to add

classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01" 

instead of

classpath "androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01"
Comment answered 11/5, 2018 at 8:19 Comment(1)
for the ref developer.android.com/topic/libraries/architecture/…Spadix
G
9

Now you can use the following classpath in order to use safe-args with AndroidX

classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0-alpha02"

For more details you can check here

Granthem answered 10/4, 2019 at 10:9 Comment(0)
B
4

I simply followed the androidx navigation release documentation Jetpack libraries Navigation Framework

In app level build.gradle file inside the dependencies block I've added

def nav_version = "2.1.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-runtime:$nav_version"

also you need to add the following at the top of the file

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"

Within the project top level build.gradle file include the following classpath

    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.1.0"
Bellied answered 9/11, 2019 at 18:31 Comment(0)
H
3

Accepted answer didn't work for me. But when I used alpha 5 it worked

Project build.gradle:

classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha05"
Hangover answered 23/8, 2018 at 21:6 Comment(0)
S
2

all of the above did not work for me. I only needed to put apply plugin: "androidx.navigation.safeargs.kotlin" after apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-android-extensions'

Shari answered 3/5, 2019 at 5:12 Comment(1)
Thanks, this was the last change needed for me. Unless otherwise needed I always alphabetize so this bit me (androidx before kotlin).Feed
L
2

I solved this problem by replacing

classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$version_navigation" 

in project level build where version_navigation = "2.1.0" with

classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$version_navigation"
Libertinism answered 7/9, 2019 at 6:29 Comment(0)
S
1

Follow below steps to resolve your problem

1. build.gradle (Module-level )

Add this in top of the file

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'androidx.navigation.safeargs'
}

Add below dependency

implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'

2. build.gradle (Project-level)

dependencies {
    classpath "com.android.tools.build:gradle:7.0.2"
    classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
    classpath 'androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5'
}
Surfing answered 15/11, 2021 at 8:4 Comment(0)
C
1

dont use

classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:..."

but

classpath "androidx.navigation:navigation-safe-args-gradle-plugin:.."
Cornwall answered 6/3, 2023 at 15:45 Comment(0)
S
0

In my case I had to add this plugin :

apply plugin: "androidx.navigation.safeargs.kotlin"

at the bottom and worked perfectly.

Shari answered 30/7, 2019 at 9:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.