Converting Android version 2.3 to 1.5
I have developed one application in Android version 2.3, and want to convert it into 1.5. Unfortunately I am experiencing some pro开发者_JS百科blem with that.
I have changed minSDK from 8 to 5 changed from property
But I still get the problem.
Any ideas?
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
android < feature> < API level>
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.
In order:
- change the
minSDK
attribute in your manifest - edit project properties and change the target platform, to ensure you rely on the good library
- do a Project > Clean to ensure, to ensure you don't have old constants in
R.java
or binary code compiled for a future platform - fix your project
- optionnaly, place back some future code, like move to SD feature in the manifest
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.
Right click the project in eclipse, go to Properties, go to android, and set the build target to 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.
精彩评论