为什么Android Studio中不能引用库如果包含在唯一的build.gradle?
在我的应用我使用的番石榴库。我在的build.gradle
文件中引用它只如下:
In my app I'm using Guava library. I have referenced it in my build.gradle
file only as follows:
dependencies {
compile 'com.google.guava:guava:13.0.1'
}
我的应用程序改造和运行正常。然而,当我试图从添加番石榴库一个新的东西,然后编译器会抱怨它不能找到类。
My app rebuilds and runs fine. However when I'm trying to add a new something from Guava library then the compiler complains that it can't find the class.
例如:当我写
import com.google.common.base.Preconditions
在我的新文件的编译器说无法解析符号共同的'
。
但我的旧文件被重建的罚款。怎么会这样?我必须以项目乱|结构
?我特别想列出任何依赖-only-在的build.gradle
。
But my old files are rebuilt fine. How so? Do I have to mess with Project|Structure
? I specifically wanted to list any dependencies -only- in build.gradle
.
看来,做一个的Gradle与同步文件工程的帮助。
It seems that doing a "sync project with gradle files" helps.
在Android的Studio中,选择:
In Android Studio, select :
工具> Android的>同步项目的gradle与文件
Tools > Android > Sync project with gradle files