Android Studio 0.4.2工作正常,今天我打开它,几乎所有东西都是红色的,自动完成已经停止工作。我看了一下导入,AS似乎告诉我它找不到android.support。V4(为我提供了删除未使用的导入的选项)。(android.support。V7似乎没问题)。

我尝试过的事情:

重建项目 清理项目 同步Gradle文件 关闭项目,关闭AS,重新启动/重新开放 文件>无效缓存/重启 检查Lint,没有发现任何明显的东西 在SDK管理器中仔细检查所有支持库是否是最新的 检查我的构建。Gradle,虽然没有变化,它和往常一样,它一直工作的方式。

下面是相关信息:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.7.+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion '19.0.0'

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 19
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
    compile 'com.android.support:gridlayout-v7:19.0.0'
    compile 'com.android.support:appcompat-v7:19.0.0'
    compile 'com.google.android.gms:play-services:4.0.30'
    compile project(':libraries:facebook')
    compile files('libs/core.jar')
}

当我点击“与Gradle同步”并打开“项目设置”时,我得到一个红色错误,告诉我我有重复的库引用,并删除未使用的。

我的项目编译和运行良好,但我真的需要自动完成工作!!有人有什么建议吗?


当前回答

我也想把这个说出来

对我有效的是将我的构建变体更改为以前工作的变体。出于某种原因,我以前改变过这个(我忘了为什么)。

无论哪种方式,最好的方法是试着记住当天你做了什么更改(可能是像清洁这样的小事情,或者回到以前的git提交)……等等。

这也有助于尝试重新同步gradle和强制重建。

其他回答

今天早上同样的问题困扰了我好几个小时。从命令行构建我的项目似乎对我有用。

〇具体步骤

克隆的新仓库(没有Android工作室文件在回购) 从命令行构建调试项目(./gradlew clean assembleDebug) 打开Android Studio,导入项目

要检查它是否工作,请查看您的项目爆炸包文件夹,检查一个库并找到classes.jar。如果它是可膨胀的,那么一切都没问题。

编辑-我发现在做了一个干净的Android工作室,它又坏了。所以如果你必须要清洁,你需要再做一遍这个过程。

我通过设置JDK解决了这个问题。当我把鼠标放在错误上时,我得到一个弹出窗口,说安装JDK。

Be aware that the name of files and specially folders can result in this error. For instance, if you have a folder "Helpers" and the package for files in this folder is "com.whatever.helpers" it won't result in any compilation error but will cause the Android studio fail to load the symbols in that folder. One typical reason for that is when you name a folder with first capital letter, commit it on Git and later change the folder name to all lower case. The Git system won't recognize the change resulting in a discrepancy between the local and remote repositories that only the new repository clones will be affect by.

通过链接,它对我有用。

1)。从android studio左上方的菜单中选择文件选项。

2)。选择选项:“使缓存无效/重新启动..”它将打开一个对话框。

3)。点击第一个带有选项的按钮:“无效并重新启动”

4)。它将关闭工作室并重新启动。开始项目索引。

它解决了我的问题:

File ->失效缓存/重启->失效并重启

来源: https://www.youtube.com/watch?v=FX_gCTpqhwM

我尝试清理项目,然后使缓存无效,这两种方法都不起作用。对我有用的是注释掉构建中的所有依赖项。Gradle (app),然后同步,然后再次取消依赖项的注释,然后再次同步。鲍勃是你的叔叔。