这个应用程序是我大约一年前完成的(!),但从未在市场上推出过.我现在正在尝试在 Eclipse 中打开它,以进行一些小的修改并稍微处理代码.所以我导入了它,然后发现这个奇怪的无法解析目标"错误.它突出显示了我所有src"文件中的每个类红色.
This app I completed around a year ago (!) but never launched it on the market place. I am trying to open it up in eclipse now to make some small modifications and work on the code a little bit. So I imported it and then found this weird "unable to resolve target" error. It's highlighting every class red in all my 'src' files.
我看过一个类似的问题,它说要将该行添加到 default.properties 文件中.我的项目有一个 project.properties 文件,其中包含以下行:
I've looked at a similar question which said to add the line to default.properties file. My project has a project.properties file which has the line:
target=android-7
任何建议如何让它工作?我总是可以开始一个新项目并复制所有的 src 文件,但这会很蹩脚且浪费时间.
Any advice how to get this to work? I could always start a new project and just copy all the src files but that would be pretty lame and time-wasting.
还有一条评论 - 我正在一台新计算机上进行开发,但我认为我没有 API 级别 7.这可能是问题吗?我已经进入了 Window --> Android SDK Manager,它显示的最旧的可用 API 是 8 级.但 7 级意味着我可以针对更多设备,所以我想使用它.
One more comment - I'm developing on a new computer and I don't think I have the API level 7. Could that be the problem? I've gone into Window --> Android SDK Manager and the oldest available API it shows is level 8. But level 7 will mean I can target more devices I think so I'd like to go with that.
感谢您的帮助.
嗯,是的,这就是你的问题.您没有下载 API 级别 7.您可以右键单击该项目并转到属性-> android 并选择另一个可用的 API.只要您不更改清单中的 min sdk 版本,您的目标设备仍然与以前一样多.
Well, yes that is your problem. You don't have the API level 7 downloaded. You can right click the project and go properties->android and select another available API. As long as you don't change the min sdk version in your manifest you are still targeting as many devices as before.
<uses-sdk android:minSdkVersion="7"/>
更新
您不必这样做,但您可以在 SDK 存档上获取较旧的 API页面
You don't have to do this, but you can get the older APIs on the SDK Archives page
我不知道下一个声明是否有任何官方来源,但这是我在工作时发现的.如果有人能以更好的答案完成此任务,我将不胜感激.
I don't know if there is any official source for the next statement but that is what I found while working. If anybody can complete this with a better answer I would appreciate it very much.
只要不使用任何与之前版本不兼容的代码,您就可以使用较新的 SDK 版本编译代码.
You can compile the code with a newer SDK version as long as you don't use any code not compatible to the previous ones.
例子:
我希望我的应用可用于 API 级别 7.但我只安装了 API 级别 15.只要我在 Manifest 中保留 minSdkVersion="7" 并且不使用以前 API 中不可用的任何资源,该应用程序就可以在我的目标设备上正常运行.
I want my app to be available for API level 7. But i only have API level 15 installed. As long as I keep the minSdkVersion="7" in my Manifest and don't use any resource not available in the previous APIs the app will work just fine on my targeted devices.
这篇关于导入项目给 Unable to resolve target 'android-7'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
为什么在 Eclipse 的 SDK 中选择 Android API 而不是 Why would you choose Android API over Google APIs in the SDK on Eclipse?(为什么在 Eclipse 的 SDK 中选择 Android API 而不是 Google API?)
admob 6.2.1 空指针异常admob 6.2.1 nullpointer exception(admob 6.2.1 空指针异常)
eclipse 无法检测到我的手机进行试运行My phone cannot be detected in eclipse to test run(eclipse 无法检测到我的手机进行试运行)
android SDK 中缺少 platform-toolsaapt.exe 目录platform-toolsaapt.exe directory missing in android SDK(android SDK 中缺少 platform-toolsaapt.exe 目录)
导入 com.google.android.gms.* 时出错;error importing com.google.android.gms.*;(导入 com.google.android.gms.* 时出错;)
Android XML 编辑器和 Eclipse 的问题...难以手动编辑Problems with Android XML Editor and Eclipse...Hard to manually edit XML(Android XML 编辑器和 Eclipse 的问题...难以手动编辑 XML)