1.Setting the minSdkVersion —— 设置minSdkVersion值

If the use of a new API is integral to the application — perhaps you need to record video using an API introduced in Android 1.5 (API Level 3) — you should add a <android:minSdkVersion> to the application's manifest, to ensure your app won't be installed on older devices.

2.Using reflection —— 使用反射

3.Using a wrapper class —— 使用包装器

The idea is to create a class that wraps all of the new APIs exposed by a new or existing class. Each method in the wrapper class just calls through to the corresponding real method and returns the same result.

4.Testing is key —— 完备的测试是最关键的

You must test your application on every version of the Android framework that is expected to support it. By definition, the behavior of your application will be different on each. Remember the mantra: if you haven't tried it, it doesn't work.

You can test for backward compatibility by running your application in an emulator that uses an older version of the platform. The Android SDK allows you to do this easily by creating "Android Virtual Devices" with different API levels. Once you create the AVDs, you can test your application with old and new versions of the system, perhaps running them side-by-side to see the differences. More information about emulator AVDs can be found in Creating and Managing Virtual Devices and from emulator -help-virtual-device.

详情请见:http://developer.android.com/resources/articles/backward-compatibility.html

更多相关文章

  1. android - mvp实现商品详情页面【仿】京东App
  2. android8.0 反射Application 启动过程
  3. Android反射工具类ReflectUtil
  4. Android详情页结合ScrollView完成Title颜色渐变效果
  5. Android 开发者从0到1发布一个微信小程序的采坑过程——详情页实
  6. Android 跳转应用市场的应用详情页
  7. Android的配置文件操作的完美封装(使用注解 反射让配置文件操作如
  8. Android listview 利用反射的自动绑定Adapter
  9. Android使用反射机制设置ListView的默认焦点

随机推荐

  1. 你要的 Spark AI Summit 2020 PPT 我已经
  2. 一口气搞懂MySQL索引所有知识点
  3. Markdown基本语法解析
  4. Playwright自动化测试工具之元素定位实战
  5. Nginx之_源码编译安装
  6. Hadoop 3.0磁盘均衡器(diskbalancer)功能
  7. Linux之文件目录作用
  8. 实证文章写作常用到的50篇名家经验帖, 学
  9. grep cut 及显示系统硬件信息命令
  10. Apache Spark 3.0 第一个稳定版发布,终于