问题描述
我有我建设的Android 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:
- 使用Git分支为2建立
- 制作本地,首先2.1的应用程序库项目,并创建将使用图书馆的公共类两个独立的项目,但
重写所有控制器 -
使用库项目,为不同的构建和焕我不得不使用一个类从特定的构建我将两个单独的项目
必须调用从库项目是这样的:
- Using git branches for the 2 builds
- Making the native, first 2.1 app a library project and creating two separate project that will use the library's common classes butrewrite all of the controllers
Use the library project, two separate project for the different build and whan I have to use a class from the specific build I willhave 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 containedin the build versions and contains the class name for the specificbuild.
所以,该方案将去somothin这样的:LIB项目将
呼吁配置类则配置类将调用上一个配置
文件中的当前版本(4.2或2.1),配置文件将返回
类名和配置类将返回类到lib
项目和库项目将实例化类与code
So the scenario will go somothin like this: the lib project willcall on the Config class then the config class will call on a configfile in the current build(4.2 or 2.1), the config file will returnthe class name and the Config class will return the class to the libProject 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版本,还是建议你使用维护两个矿更多的Android构建的方式,更好或最佳方式。
谢谢
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领域。它们允许你支持一系列的Android版本在相同的应用程序。
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闵SDK版本与目标SDK版本
这篇关于不同的Android版本的构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!