我从这里下载了 android 演示新闻阅读器项目,并使用 Import > Existing Projects Into Workspace 将其导入到 eclipse 中。我还将 android-support-v4.jar 添加到构建路径中,就像这里所说的那样
我遇到的问题与访问资源有关。这是我得到的错误。
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 目录中找不到它。我曾尝试清理项目并重新启动 Eclipse,但它们没有工作。
任何帮助都会很重要。
迪斯科