我正在尝试编译Android SDK附带的Google的ApiDemos。 但我只能跑去!它让我疯了!!
当我在Eclipse中基于示例(目标1.5或1.6)创建一个新项目并尝试编译和运行时,我得到了将近一千个错误。不是我对教程应用程序的期望!
Description Resource Path Location Type
IRemoteService cannot be resolved RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 84 Java Problem
IRemoteService cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 92 Java Problem
IRemoteService cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 104 Java Problem
IRemoteService cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 104 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 41 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 84 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 91 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 107 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 141 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 155 Java Problem
IRemoteService cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 157 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 51 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 52 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 79 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 105 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 106 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 108 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 109 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 142 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 145 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 151 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 91 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 157 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 212 Java Problem
IRemoteServiceCallback cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 212 Java Problem
ISecondary cannot be resolved RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 125 Java Problem
ISecondary cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 95 Java Problem
ISecondary cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 116 Java Problem
ISecondary cannot be resolved to a type RemoteService.java /ApiDemos/src/com/example/android/apis/app line 116 Java Problem
ISecondary cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 43 Java Problem
ISecondary cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 125 Java Problem
ISecondary cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 130 Java Problem
ISecondary cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 143 Java Problem
ISecondary cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 179 Java Problem
ISecondary cannot be resolved to a type RemoteServiceBinding.java /ApiDemos/src/com/example/android/apis/app line 181 Java Problem
R cannot be resolved to a variable AdvancedPreferences.java /ApiDemos/src/com/example/android/apis/app line 58 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 73 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 76 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 78 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 80 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 108 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 140 Java Problem
R cannot be resolved to a variable AlarmController.java /ApiDemos/src/com/example/android/apis/app line 162 Java Problem
R cannot be resolved to a variable AlarmService.java /ApiDemos/src/com/example/android/apis/app line 52 Java Problem
R cannot be resolved to a variable AlarmService.java /ApiDemos/src/com/example/android/apis/app line 55 Java Problem
R cannot be resolved to a variable AlarmService.java /ApiDemos/src/com/example/android/apis/app line 57 Java Problem
R cannot be resolved to a variable AlarmService.java /ApiDemos/src/com/example/android/apis/app line 72 Java Problem
R cannot be resolved to a variable AlarmService.java /ApiDemos/src/com/example/android/apis/app line 84 Java Problem
R cannot be resolved to a variable AlarmService_Service.java /ApiDemos/src/com/example/android/apis/app line 62 Java Problem
R cannot be resolved to a variable AlarmService_Service.java /ApiDemos/src/com/example/android/apis/app line 65 Java Problem
R cannot be resolved to a variable AlarmService_Service.java /ApiDemos/src/com/example/android/apis/app line 100 Java Problem
R cannot be resolved to a variable AlarmService_Service.java /ApiDemos/src/com/example/android/apis/app line 103 Java Problem
R cannot be resolved to a variable AlarmService_Service.java /ApiDemos/src/com/example/android/apis/app line 111 Java Problem
R cannot be resolved to a variable AlarmService_Service.java /ApiDemos/src/com/example/android/apis/app line 116 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 75 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 76 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 77 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 83 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 92 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 93 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 94 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 95 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 101 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 107 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 116 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 117 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 121 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 130 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 131 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 134 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 140 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 149 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 150 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 151 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 157 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 163 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 172 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 173 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 174 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 183 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 189 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 199 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 201 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 202 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 204 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 210 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 230 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 233 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 241 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 250 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 258 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 269 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 277 Java Problem
R cannot be resolved to a variable AlertDialogSamples.java /ApiDemos/src/com/example/android/apis/app line 285 Java Problem
R cannot be resolved to a variable AlphaBitmap.java /ApiDemos/src/com/example/android/apis/graphics line 67 Java Problem
R cannot be resolved to a variable AnimateDrawables.java /ApiDemos/src/com/example/android/apis/graphics line 46 Java Problem
R cannot be resolved to a variable Animation1.java /ApiDemos/src/com/example/android/apis/view line 34 Java Problem
R cannot be resolved to a variable Animation1.java /ApiDemos/src/com/example/android/apis/view line 36 Java Problem
R cannot be resolved to a variable Animation1.java /ApiDemos/src/com/example/android/apis/view line 41 Java Problem
R cannot be resolved to a variable Animation1.java /ApiDemos/src/com/example/android/apis/view line 42 Java Problem
...and 841 more.
我做错了什么?
答案 0 :(得分:12)
我遇到了同样的问题。
我发现eclipse已自动定位到Android 1.6。但API演示来自4.4.2 sdk。
我在项目属性中将“项目构建目标”更改为Android 4.4.2,并且编译并运行正常。
答案 1 :(得分:5)
我刚才有同样的事情,发现埋藏在大量的错误列表中,对于strings.xml有一些xml解析错误。 eclipse不喜欢文本中有4个未转义的单引号。问题字符串是“我关了!” “我正在开启!”,“你将”和“你是”在文本的大块中开始“Android平台是一个软件堆栈......”。如果你通过在每个撇号前放置\来逃避这些,所有错误都会神奇地消失:)
答案 2 :(得分:1)
起初我遇到了问题。这对我有用,使用API 15:
我认为这很难设置,因为初始尝试会在文件结构中生成eclipse文件,后续尝试会失败,因为eclipse会再次尝试使用这些文件。
答案 3 :(得分:0)
请尝试从File-> Import导入API Demo项目,然后显示API Demo文件夹的目录。
答案 4 :(得分:0)
尝试定位最新的SDK版本,而不是1.5或1.6。
答案 5 :(得分:0)
我遇到了同样的问题。我正在运行MyEclipse 8.0。当您查看这些错误时,您会发现需要引入IRemoteService类。我假设这意味着com.eclipse.ecf.remoteservice.IRemoteService接口。我试图加载ecf项目但是存在问题。如果有人已成功将ECF集成到他们的Eclipse中,请告诉我。
答案 6 :(得分:0)
确保已将属性> android设置为正确的构建目标 - 然后清理并重试。
答案 7 :(得分:0)
我有类似的问题,我发现这是因为我已经将项目导入Eclipse工作区,我已经打开了其他项目。我在“Package Explorer”窗格中选择了这些项目,然后选择了Project->关闭项目。我在工作区中为每个其他项目执行了此操作,只打开了ApiDemos项目。然后我做了一个干净的构建,它成功了。 (有293个警告 - 哎呀)。
答案 8 :(得分:0)
我在使用Gradle构建系统的Android Studio中遇到类似的问题。
我的理由不是正确地编译aidl文件,例如{em}实际上在 IRemoteService.aidl 中定义了IRemoteService
。所以我的解决方案是在 build.gradle 中添加sourceSets配置,如下所示:
sourceSets {
main {
dirs.each { dir ->
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs "src"
res.srcDirs "res"
aidl.srcDirs "src"
}
}
答案 9 :(得分:-1)
我有同样的问题,这是我的解决方案。
然后它应该编译(至少对我而言)。
在此之后,您可以再次在“项目”菜单中选中“自动构建”。
从https://stackoverflow.com/a/9670606/785827复制。 希望它有所帮助!
来自德国的致敬。