无法解决:androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1

我正在尝试使用新的导航架构组件用于 Android,我收到了错误
无法解决:androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1
当我将lifecycle_version定义为“1.1.1”时

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

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

它似乎是以某种方式清空了存储库.因此,您无法从存储库下载它.

相关文章

Android性能优化——之控件的优化 前面讲了图像的优化,接下...
前言 上一篇已经讲了如何实现textView中粗字体效果,里面主要...
最近项目重构,涉及到了数据库和文件下载,发现GreenDao这个...
WebView加载页面的两种方式 一、加载网络页面 加载网络页面,...
给APP全局设置字体主要分为两个方面来介绍 一、给原生界面设...
前言 最近UI大牛出了一版新的效果图,按照IOS的效果做的,页...