android - 从git推拉后出错

标签 android android-studio gradle build.gradle

我有一个 android studio 项目,它很糟糕。我已经将它推送到 gitlab 并在删除它之后,我又将它拉了回来。 现在我想构建我的 gradle 时出现此错误:

Error:The module 'app' is an Android project without build variants, and cannot be built.Please fix the module's configuration in the build.gradle file and sync the project again.

这是我的build.gradle:

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "sample.spart.com"
        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 {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:26.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.android.support:cardview-v7:27.0.2'
    implementation 'com.android.support:design:27.0.2'
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.android.support:recyclerview-v7:26.0.0-alpha1'
}

问题是什么,我该如何解决?

最佳答案

也许您可以尝试使您的现金无效。 在安卓工作室中: 文件 -> 使缓存无效/重新启动

共享项目的 build.gradle 文件可能会有所帮助。

关于android - 从git推拉后出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50183788/

相关文章:

java - 将我的数据库移动到 SD 卡不起作用

android - 向 Android 模拟器添加音乐?

android - 手机可以伪装成蓝牙键盘吗?

build - 如何在防火墙后/使用代理Maven服务器运行gradle包装器?

java - TextView 不以科学记数法显示大值

android - 将 android 项目从 eclipse 迁移到 android studio 时出现 "Gradle location is incorrect"

java - 从抽屉菜单中加载 webview 中的本地 HTTP 文件?

java - 如何修复 XML 中阻止显示预览或在 Android Studio 上运行应用程序的错误(红色文本)?

gradle - 用gradle构建libxml

java - 如何防止 jacoco 检测生产代码?