在几周/几个月后(非常忙于工作)第一次打开较旧的项目后,Android Studio要求我升级到最新的gradle插件。Android Studio:在Gradle更新后恢复项目备份
我真的没有想到它是什么,然后点击“更新”。 Gradle完成更新和同步后,我发现我的大部分布局和java类文件都消失了。他们只是走了。
但是,在我的项目目录中出现了一个名为“projectFilesBackup”的文件夹。我认为恢复此文件夹中包含的备份可能会丢失我丢失的文件。
所以我的问题是:有谁知道我怎么居然告诉过Android Studio恢复到备份?它只包含一个包含“workspace.xml”的“.idea”文件夹。任何帮助将不胜感激。
我已经尝试使用“本地历史记录”撤消Gradle Update当天所做的任何更改,详见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'
}
发布你的两个build.gradle文件。 – fluffyBatman
感谢您的评论。我已将这些文件编辑到我原来的文章中。 – user4370243
你的build.gradle文件配置对我来说看起来不错。如果你启动一个gradle sync,它说什么? – fluffyBatman