2012-06-13 48 views
0

我從here下載了android demo新聞閱讀器項目,並使用Import> Existing Projects Into Workspace將其導入到eclipse中。 我還將android-support-v4.jar添加到構建路徑中,就像它說的那樣hereAndroid新聞閱讀器演示項目問題

我得到的問題與訪問資源有關。這裏是我得到的錯誤。

Description Resource Path Location Type 
ReaderTutorial/src/com/example/android/newsreader line 143 Java Problem 
android.app.ActionBar cannot be resolved to a variable NewsReaderActivity.java  /NewsReaderTutorial/src/com/example/android/newsreader line 151 Java Problem 
error: Error retrieving parent for item: No resource found that matches the given name 'android:style/Widget.Holo.Light.ActionBar.TabView'. style.xml /NewsReaderTutorial/res/values-v11 line 23 Android AAPT Problem 
error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light.NoActionBar'. style.xml /NewsReaderTutorial/res/values-v11 line 33 Android AAPT Problem 
error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Holo.Light'. style.xml /NewsReaderTutorial/res/values-v11 line 28 Android AAPT Problem 
error: Error: No resource found that matches the given name: attr 'android:actionBarTabStyle'. style.xml /NewsReaderTutorial/res/values-v11 line 30 Android AAPT Problem 
error: Error: No resource found that matches the given name: attr 'android:actionBarTabTextStyle'. style.xml /NewsReaderTutorial/res/values-v11 line 29 Android AAPT Problem 
FragmentTransaction cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 54 Java Problem 
FragmentTransaction cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 76 Java Problem 
FragmentTransaction cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 84 Java Problem 
OnNavigationListener cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 35 Java Problem 
R cannot be resolved to a variable ArticleActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 51 Java Problem 
R cannot be resolved to a variable HeadlinesFragment.java /NewsReaderTutorial/src/com/example/android/newsreader line 75 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 76 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 80 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 82 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 86 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 101 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 152 Java Problem 
R cannot be resolved to a variable NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 183 Java Problem 
Tab cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 54 Java Problem 
Tab cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 76 Java Problem 
Tab cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 84 Java Problem 
TabListener cannot be resolved to a type CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 35 Java Problem 
The import android.app.ActionBar cannot be resolved CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 19 Java Problem 
The import android.app.ActionBar cannot be resolved CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 20 Java Problem 
The import android.app.ActionBar cannot be resolved CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 21 Java Problem 
The import android.app.FragmentTransaction cannot be resolved CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 22 Java Problem 
The method getActionBar() is undefined for the type NewsReaderActivity NewsReaderActivity.java /NewsReaderTutorial/src/com/example/android/newsreader line 137 Java Problem 
The method onNavigationItemSelected(int, long) of type CompatActionBarNavHandler must override or implement a supertype method CompatActionBarNavHandler.java /NewsReaderTutorial/src/com/example/android/newsreader line 65 Java Problem 

我知道這是不是很多繼續下去,但我一直在尋找周圍,找不到任何東西作爲一個相當新的演示。

我認爲這可能是R.java文件沒有被生成,因爲我無法在我的gen目錄中找到它。我已經嘗試清理項目並重新啓動日食,但他們沒有工作。

任何幫助將是盛大的。

迪斯科

+1

你的鏈接源項目正在爲我工​​作。 –

回答

5

它已經有一段時間了,但是這爲我解決了這個問題。
你有沒有導入:

import android.app.ActionBar; 

由於某種原因,我的項目有:

import android.app.ActionBar.Tab; 
import android.app.ActionBar.TabListener; 

import android.app.ActionBar;和它的工作。

+0

+1這解決了我的問題(導入錯誤)!我正在構建SDK版本14(4.0)。設置了android:minSdkVersion =「11」和android:targetSdkVersion =「17」。 – AgentKnopf

0

你需要改變你的構建目標是API級別11或更高版本。

0

我從來沒有找到解決這個問題的方法。如果有人找到不同的激光,請隨時張貼在這裏,我會接受它。

0

您需要單擊Android Manifest.xml文件下的項目屬性文件並將目標從8更改爲目標13或更高。