2013-09-05 58 views
14

我試圖創建並運行hello world新應用程序使用Android studio. 但是我無法編譯,因爲它說它無法解析Activity符號。android studio找不到「活動」符號

以及黑色模板中的其他基本符號。

我建議添加/配置JDK。

我想我這樣做是錯誤的,因爲我試圖添加JDK和問題重新發生。

enter image description here

如何解決這個問題?

UPDATE1

找不到外部構建

enter image description here

enter image description here

的Android工作室0.2.6

+0

重新啓動,清理並重新uild解決問題 http://stackoverflow.com/questions/18563026/android-studio-cannot-resolve-symbol-xxx-on-basic-android-tutorial –

回答

4

我就遇到了這個問題,以及和它快把我逼瘋。這是什麼爲我工作:

我注意到,根據文件|項目結構我選定的Android SDK(Android 4.3谷歌APIs)的類路徑是空白的。

我將構建目標更改爲不同的SDK,然後切換回來,Classpath選項卡正確填充。一旦我這樣做了,android符號在我的項目中解決了。

如果你沒有在類路徑中看到pathtosdk/android - ##/android.jar,這可能是你的解決方案。

18

Android Studio中

文件 - >的Invalidate緩存/重啓

它爲我工作。

+0

爲我工作呢! –

+0

也爲我工作,謝謝。 –

4

確保導入android.app.Activity。

import android.app.Activity; 
0

文件 - >的Invalidate緩存/重啓

它的工作對我來說太。