1

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?

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Nikunj Patel
  • 21,853
  • 23
  • 89
  • 133
  • 1
    Have you checked that every API feature you use exists in the ancient A1.5? – Emyr Aug 02 '11 at 12:36
  • 1
    Why are you converting it back? There are probably many methods, classes, and variables that 2.3 has that 1.5 doesn't! Changing minSDK won't fix the problem as it doesn't help resolve the real issue. – Otra Aug 02 '11 at 12:40
  • i forgot that i have build this app in 1.5. and by mistak i have develop it in 2.3. now any artical that contain 1.5 & 2.3 feature ? so i can compare it and change it – Nikunj Patel Aug 02 '11 at 12:42
  • 1
    The bounty obviously means you want this question answered, so why don't you spend 10 minutes to add a better description of the problem? That, more than the bounty, will ensure good answers. – Marmoy Aug 09 '11 at 20:32

5 Answers5

7

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.

Marmoy
  • 8,009
  • 7
  • 46
  • 74
6

In order:

  1. change the minSDKattribute in your manifest
  2. edit project properties and change the target platform, to ensure you rely on the good library
  3. 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
  4. fix your project
  5. optionnaly, place back some future code, like move to SD feature in the manifest
rds
  • 26,253
  • 19
  • 107
  • 134
  • this all thing i known very well. but here problem are raise memory – Nikunj Patel Aug 09 '11 at 08:48
  • when i am check my app in 2.3.3 with 700 mb ram so work fine but when i am check it in 2.1 with 300 mb ram it get error – Nikunj Patel Aug 09 '11 at 08:49
  • Huh. That's a very different question then. I thought you were not able to compile on 2.1 or had `ClassNotFoundError`. So: what is your error? 300 MB should be enough memory (what else have you isntalled?) – rds Aug 09 '11 at 09:07
3

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.

BrainCrash
  • 12,992
  • 3
  • 32
  • 38
3

Right click the project in eclipse, go to Properties, go to android, and set the build target to 1.5.

Rob
  • 2,779
  • 5
  • 23
  • 34
  • 1
    And do a *Project* > *Clean* to ensure you don't rely on constants compiled into your `R.java` file. – rds Aug 09 '11 at 08:12
2

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.

Andro Selva
  • 53,910
  • 52
  • 193
  • 240
  • i have check each feature and they are all since from 1.5 – Nikunj Patel Aug 02 '11 at 12:45
  • and i have also take precaution when i have develop it.but now problem are raise when i am check it in device. – Nikunj Patel Aug 02 '11 at 12:46
  • it is force close error while i have check it in 2.2 version android device but when i am check it in 2.3 it running better.i know that some feature are not supporting in 1.5,so why it should not give syntax error? – Nikunj Patel Aug 03 '11 at 04:21
  • requestWindowFeature(Window.FEATURE_NO_TITLE); feature are use in 1.5 ? if not supported then give me similar kind of code. – Nikunj Patel Aug 03 '11 at 04:34
  • 1
    But I believe this is supported from 1.5 – Andro Selva Aug 03 '11 at 04:40
  • 1
    Are you sure this is what is causing your app to crash. Didi u check logcat details properly – Andro Selva Aug 03 '11 at 04:50
  • there are no logcate generate, even i remove try and catch block. – Nikunj Patel Aug 03 '11 at 06:32
  • hai andro selva, just tell me i have give threading and so much CountdownTimer , so reason of that, is application crash ? – Nikunj Patel Aug 03 '11 at 07:08
  • 1
    without looking at the code I am unable to suggest you. If you can send me the source code to my mail I might be able to do something. And in case you want my mail ID you can find it in my stackoverflow profile details – Andro Selva Aug 03 '11 at 07:19
  • Have you rebuilt the app since changing the target SDK? – Emyr Aug 03 '11 at 12:41
  • in my app i have add `sound`, at number 5 activity there are 6 sound play one by one at the 6 number it raise the problem in `2.1 device`. this app is completely running in `1.5 emulator` and also running in 2.3.3.but i cant able to understand exactly what are doing here. one more thing is that in my 6 number activity i have **surrounding** with try and catch but still force close in 2.1 – Nikunj Patel Aug 04 '11 at 11:04
  • **I have got problem from yesterday**, i have just remove that sound so it will work fine.and i have also check that is sound file is corrupted? but no...its not corrupted.and previously those file are running very well. – Nikunj Patel Aug 04 '11 at 11:06
  • i have also try with making services of single sound.and put it at its location but at the same time same error are raise.i thought that may be this is problem of clean,and i have also clean my project and genrate my apk but still not get solution. in short i have check entire project code and try in different - different 3 device. – Nikunj Patel Aug 04 '11 at 11:11