无法解决:androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1 [英] Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1

查看:1081
本文介绍了无法解决:androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为Android使用新的Navigation Architecture Component,但出现错误 无法解决:androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1 当我将lifecycle_version定义为"1.1.1"时

I'm trying to use the new Navigation Architecture Component for android and I'm getting the error Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1 when I'm defining the lifecycle_version to "1.1.1"

我基本上只是复制和粘贴文档中的内容,所以我对这里的错误有很多想法:(

I'm basically just copying and pasting what is in the documentation so I'm running out of ideas of what is wrong in here :(

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

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

    dependencies {
    def lifecycle_version = "1.1.1"

    // ViewModel and LiveData
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
    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'
}

推荐答案

尝试替换

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

与此

//https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel-ktx
implementation group: 'androidx.lifecycle', name:'lifecycle-viewmodel-ktx', version: '2.0.0-alpha1'

然后再次同步.

您可以在这里看看: https://mvnrepository.com/artifact/androidx.lifecycle /lifecycle-viewmodel-ktx/2.0.0-alpha1

You can have a look here : https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel-ktx/2.0.0-alpha1

似乎是由于某种原因清空了存储库.因此,您不能从存储库下载它.

it seems to be that the repository was emptied somehow. Hence, you can not download it from the repository.

这篇关于无法解决:androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆