Android Studio:Gradle Update后恢复项目备份

时间:2016-10-16 09:36:21

标签: android android-studio android-gradle

在几周/几个月(非常忙于工作)之后第一次打开旧项目后,Android Studio要求我升级到最新的gradle插件。

Gradle Upgrade promt

我并没有真正想到任何事情,并点击了#34;更新"。在Gradle完成更新和同步之后,我注意到我的大多数布局和java类文件都消失了。他们只是走了。

但是,在我的项目目录中有一个名为" projectFilesBackup"的文件夹。出现了。我假设恢复此文件夹中包含的备份可能会丢失我丢失的文件。

projectFilesBackup Folder

所以我的问题是:有谁知道我实际上是如何告诉Android Studio恢复备份的?它只包含一个" .idea"包含" workspace.xml"的文件夹。任何帮助将不胜感激。

我已经尝试过使用"本地历史"撤消在Gradle更新当天所做的任何更改,详见this SO post

修改: 根据要求我的build.gradle文件:



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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'
        classpath "io.realm:realm-gradle-plugin:1.2.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}






apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
    compileSdkVersion 24
    buildToolsVersion "24.0.1"

    defaultConfig {
        applicationId "com.tools.awesome.cs.grademanager"
        minSdkVersion 23
        targetSdkVersion 24
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.2.0'
    compile 'com.android.support:design:24.2.0'
    compile 'io.realm:android-adapters:1.3.0'
}




1 个答案:

答案 0 :(得分:0)

将realm-gradle-plugin更改为最过时的插件,看看它是否会再次显示文件。

classpath "io.realm:realm-gradle-plugin:2.0.2"
相关问题