user1796624
user1796624

Reputation: 4007

android different build versions

I have a android app that I'm building in android 2.1. But the time has come to switch to a bigger build. What is the best way to support 2 or more android build versions. I had some suggestions like:

  1. Using git branches for the 2 builds
  2. Making the native, first 2.1 app a library project and creating two separate project that will use the library's common classes but rewrite all of the controllers
  3. Use the library project, two separate project for the different build and whan I have to use a class from the specific build I will have to call something like this from the library project:

    Class<ExpandableListAdapter> adapterClass = Config.getHotelDistrictAdapterClass();
            hotelAdapter = adapterClass.getConstructor(String.class).newInstance(HotelDistrictListActivity.this,
    

    0, hotelList.size(), hotelList, cretedFromAssets);

    where the Config class will counsult a config file that is contained in the build versions and contains the class name for the specific build.

    So the scenario will go somothin like this: the lib project will call on the Config class then the config class will call on a config file in the current build(4.2 or 2.1), the config file will return the class name and the Config class will return the class to the lib Project and the Lib Project will instanciate the class with the code :

    hotelAdapter = adapterClass.getConstructor(String.class).newInstance(HotelDistrictListActivity.this, 0, hotelList.size(), hotelList,cretedFromAssets);

Please suggest what is the better or best way to maintain two separate builds for two android versions, or suggest the way that you use to maintain two ore more android builds. Thanks

Upvotes: 0

Views: 262

Answers (2)

Mahdi Giveie
Mahdi Giveie

Reputation: 640

You can Easily set your MinSDKVersion to 8 or 7 for and set your Building Target to 16 or 17 this can be done from your Manifest.xml file

Upvotes: 0

Snicolas
Snicolas

Reputation: 38168

You should have a look at AndroidManifest.xml minSDKVersion and targetSDKVersion fields. They allow you to support a range of android versions in the same app.

Android Min SDK Version vs. Target SDK Version

Upvotes: 1

Related Questions