将 Android 版本 2.3 转换为 1.5
我在Android 2.3版本中开发了一个应用程序,想将其转换为1.5版本。 不幸的是我遇到了一些问题。
我已将 minSDK 从 8 更改为 5 从属性更改
但我仍然遇到问题。
有什么想法吗?
I have developed one application in Android version 2.3, and want to convert it into 1.5.
Unfortunately I am experiencing some problem with that.
I have changed minSDK from 8 to 5
changed from property
But I still get the problem.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
转换应用程序的版本号涉及多个方面。
Android 版本越高,支持的功能越多。功能包括前置摄像头支持、NFC 支持、片段或拖放等。
如果您计划转换应用程序,请确保目标版本支持您需要的功能。 这描述了不同 API 级别之间的主要差异
Android API 会随着每个新的 Android 版本而更新。这意味着方法、常量和属性在某些 API 级别上可用,但在其他 API 级别上则不可用。 要查看哪个 API 级别提供的功能,请访问 android 文档< /a> 并在右上角选择“按 api 级别过滤”。然后选择 API 级别。执行此操作后,所选 API 级别中不可用的所有 API 功能都将灰显,以便轻松识别可用元素。如果您的代码包含目标级别中不存在的元素,您将收到错误。
您需要在 Eclipse 中的两个(!)位置显式指定 Android 版本。
要在 Eclipse 中更改 Android 项目的 API 级别:
a.打开项目清单并更改 minSdkVersion:
b.打开属性-> Android,并更改项目构建目标(API 级别)。
最后清理您的项目(项目 -> 清理...)以确保项目引用已更新。
执行此操作后,更新的 API 级别中不可用的任何功能(方法、常量、属性等)将在您的项目中显示为错误。
为了修复这些错误,Google
<块引用>
安卓<特点> < API级别>
这通常会引导您找到替换代码。
重新阅读问题后,我相信我发现了具体错误:
您说您已将 minSdkVersion 设置为 5。API 级别 5 对应于 Android 版本 2.0。
你还说你想将你的项目转换为 Android 版本 1.5,这让我相信你已经将你的项目构建目标设置为相应的 API 级别 3。
如果你更改其中一个以匹配另一个,你原来的问题应该得到解决。
There are several aspects to converting an application's version number.
The later the Android version, the more features are supported. Features are things like front-facing camera support, NFC support, Fragments or Drag and drop.
If you plan to convert an application, make sure that the target version supports the features you need. This describes the major differences between the various API levels.
The Android API is updated with each new Android version. This means that methods, constants and attributes can be available on some API levels, but not on others. To see what is available in which API level, go to the android documentation and in the upper right corner select 'filter by api level'. Then select an API level. After you do that all API features that weren't available in the selected API level will be grayed out making it easy to identify the available elements. If your code contains elements that don't exist in the targeted level, you will get errors.
You need to explicitly specify the Android version in two(!) places in Eclipse.
To change the API level of an Android project in Eclipse:
a. Open the project manifest and change the minSdkVersion:
b. Open Properties -> Android, and change the Project Build Target (API level).
Finish by cleaning your project (Project -> Clean...) to ensure that the project references are updated.
After doing this, any features (methods, constants, attributes, etc.) not available in the updated API level will show up as errors in your project.
To fix these errors, Google
which will often lead you to replacement code.
After re-reading the question I believe I've found the specific mistake:
You say you've set the minSdkVersion to 5. API level 5 corresponds to Android version 2.0.
You also say you want to convert your project to Android version 1.5, which leads me to believe that you've set your Project Build Target to the corresponding API level 3.
If you change either of those to match the other, your original problem should be solved.
按顺序:
minSDK
属性In order:
minSDK
attribute in your manifestR.java
or binary code compiled for a future platform向后转换意味着您必须编写替代代码来替换在旧版本 SDK=5 中不支持的高版本 SDK=8 中使用的 api 方法,因为在旧版本中这些方法将不存在。
如果您提前计划支持的最低版本,那就更好了。
To convert backward means that you have to write alternative code to replace method for api you used in the higher version SDK=8 that aren't supported in the old SDK=5, because in the old version those methods won't exist.
It is better if you plan ahead witch minimum version to support.
右键单击 Eclipse 中的项目,转到“属性”,转到“android”,然后将构建目标设置为 1.5。
Right click the project in eclipse, go to Properties, go to android, and set the build target to 1.5.
如果您使用过 android 1.5 发布后添加的任何内置函数或方法或常量或属性,并且现在尝试更改为 1.5,您将无法做到这一点。确保您没有使用此类方法或 1.5 中未发布的任何其他属性。
If you have used any inbuild functions or methods or constants or attributes that was added after the release of android 1.5 and if you try to change to 1.5 now, you will not be able to do that. Make sure that you have not used such kind of methods or any other attributes that was not released in 1.5.