不同的Andr​​oid版本的构建 [英] android different build versions

查看:260
本文介绍了不同的Andr​​oid版本的构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我建设的Andr​​oid 2.1 Android应用程序。但是,时间已经到了切换到一个更大的版本。什么是支持2个或更多机器人的构建版本的最佳方式。
我有一些建议,如:

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. 使用Git分支为2建立

  2. 制作本地,首先2.1的应用程序库项目,并创建将使用图书馆的公共类两个独立的项目,但
    重写所有控制器

  3. 使用库项目,为不同的构建和焕我不得不使用一个类从特定的构建我将两个单独的项目
    必须调用从库项目是这样的:

  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);

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

,其中配置类将counsult所包含的配置文件
在构建版本和包含特定的类名
建立。

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.

所以,该方案将去somothin这样的:LIB项目将
呼吁配置类则配置类将调用上一个配置
文件中的当前版本(4.2或2.1),配置文件将返回
类名和配置类将返回类到lib
项目和库项目将实例化类与code

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);

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

请所说的其实是维护两个单独建立了两款Android版本,还是建议你使用维护两个矿更多的Andr​​oid构建的方式,更好或最佳方式。
谢谢

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

推荐答案

您应该看一看在AndroidManifest.xml中的minSdkVersion和targetSDKVersion领域。它们允许你支持一系列的Andr​​oid版本在相同的应用程序。

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.

<一个href=\"http://stackoverflow.com/questions/4568267/android-min-sdk-version-vs-target-sdk-version\">Android闵SDK版本与目标SDK版本

这篇关于不同的Andr​​oid版本的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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