Android Studio“无法解析符号字符串" [英] Android Studio "cannot resolve symbol String"
问题描述
我有一个在 Eclipse 中启动的小项目.然后我将其导出为 gradle 文件,然后将其导入 AS (0.5.7).
I have a small project that was started in Eclipse. I then exported it to a gradle file, and imported it to AS (0.5.7).
起初,似乎没有多少工作正常,但是在构建 => 制作项目"之后,我似乎没有遇到任何突出显示的错误.
At first, not much seemed to work as it should, but after a "build => make project", I didn't seem to get any highlighted errors or so.
所以我尝试在模拟设备上运行该应用程序.好吧,该设备从未启动,现在我在提到String"、ArrayList"等时看到红色波浪线,说它无法解析符号".
So I tried to run the app to an emulated device. Well, the device never launched, and now I get red squiggly lines under mentions of "String", "ArrayList" etc, saying it "cannot resolve the symbol".
什么?
我尝试过清理和重建,以及将项目与 gradle 文件同步".
I have tried cleaning and rebuilding, as well as "sync project with gradle files".
我该往哪里去?我很想开始在 AS 中进行开发!
Where do I go from here? I want to get going with developing in AS so bad!
项目设置截图:http://i.imgur.com/ycNyPaT.png一个>
build.gradle 的内容:
Contents of build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
推荐答案
有更简单的我认为更正确的方法:
There is simpler and I think more correct way:
对我来说,这成功解决了问题(由 PC 意外断电引起)
For me this successfully resolved the issue (was caused by surprising power off of PC)
这篇关于Android Studio“无法解析符号字符串"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!