Android Studio 突然无法解析符号 - Android Studio suddenly cannot resolve symbols

10/14 10:30
阅读数 0

问题:

Android Studio 0.4.2 was working fine and today I opened it and almost everything was red and the auto-completion had stopped working. Android Studio 0.4.2 运行良好,今天我打开它,几乎所有内容都是红色的,并且自动完成功能已停止工作。 I look at the imports and AS seems to be telling me it can't find android.support.v4 all of a sudden (offering me the option to remove the unused imports).我查看了导入,AS 似乎告诉我它突然找不到android.support.v4 (为我提供了删除未使用的导入的选项)。 ( android.support.v7 seems to be fine though). android.support.v7似乎没问题)。

Things I have tried:我尝试过的事情:

  • Rebuilding the project重建项目
  • Cleaning the project清理项目
  • Syncing with Gradle Files与 Gradle 文件同步
  • Closing the Project, closing AS and relaunching / reopening关闭项目,关闭 AS 并重新启动/重新打开
  • File > Invalidate Caches / Restart文件 > 使缓存无效/重新启动
  • Examining Lint, didn't see anything obvious检查 Lint,没有看到任何明显的东西
  • Double checking all support libraries are up to date in the SDK manager在 SDK 管理器中仔细检查所有支持库是否是最新的
  • Examining my Build.gradle, although no changes and it's the same as usual, the way it was working all the time.检查我的 Build.gradle,虽然没有变化,它和往常一样,但它一直在工作。

Here it is in case it's relevant:这是相关的:

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')
}

When I hit "Sync with Gradle" and open "Project Settings" I get a red error telling me I have duplicate library references and to remove the unused ones..当我点击“与 Gradle 同步”并打开“项目设置”时,我收到一个红色错误,告诉我我有重复的库引用并删除未使用的。在此处输入图片说明

My project compiles and runs fine but I really need the autocomplete working!!我的项目编译并运行良好,但我真的需要自动完成工作!! Does anyone have any suggestions?有没有人有什么建议?

在此处输入图片说明


解决方案:

参考一: https://en.stackoom.com/question/1QXFg
参考二: https://stackoom.com/question/1QXFg
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部