旧项目可以正常工作,但不能创建新项目

时间:2019-07-03 19:54:01

标签: android android-studio

在我的Mac上,我可以打开以前的项目,但无法创建新项目,因为我一直面临这些问题,我尝试清理项目和android studio现金,但无济于事:

ERROR: Failed to resolve: runtime
Affected Modules: app


ERROR: Failed to resolve: viewmodel
Affected Modules: app


ERROR: Failed to resolve: livedata-core
Affected Modules: app

我的build.gradle文件:

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.myapplication"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    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'
}

2 个答案:

答案 0 :(得分:0)

通过从菜单栏中单击“重构”>“迁移到AndroidX”,尝试将Android迁移到Android X。

答案 1 :(得分:0)

尝试文件>设置>构建和部署> 取消选中离线工作