导入项目无法解析目标“android-7” [英] Importing project gave Unable to resolve target 'android-7'

查看:189
本文介绍了导入项目无法解析目标“android-7”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个程序在一年前完成了(!),但从未在市场上推出。我试图在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。但是第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。您可以右键单击该项目并转到properties-> android并选择另一个可用的API。只要您不更改清单中的最小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安装。只要我在我的清单中保持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.

这篇关于导入项目无法解析目标“android-7”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆