在 API 10 上开发 Android 应用程序 - 它仍会在具有 API 7 的设备上运行吗? [英] Developing Android app on API 10 - will it still run on devices with API 7?

查看:23
本文介绍了在 API 10 上开发 Android 应用程序 - 它仍会在具有 API 7 的设备上运行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Android 世界的新手,有一个简单的问题.

I am kind of new to Android world and have a simple question.

如果我使用 API 13(或 API10)上的库开发一个应用程序,这个应用程序还会在只安装了 API 7 的 Android 手机上运行吗?

If I develop an app using libraries on API 13 (or API10) will this app still run on Android phones which have only API 7 installed?

当我尝试在带有 API 7 的 Android 手机上使用 EClipse 运行我当前的应用程序时,我收到一条错误消息,指出我的应用程序至少需要 API 10 - 所以我害怕在 API 13 上进行开发.

When I try to run my current app with EClipse on my Android phone with API 7 I get an error message that my app requires at least API 10 - so I am afraid to develop on API 13.

我最好坚持使用 API 7 而不要使用新功能吗?

在这种情况下,最好的做法是什么?

Whats the best thing to do in this situation?

非常感谢

推荐答案

如果您不使用旧 API 中不存在的 API10 中的任何函数,它将起作用.

It will work if you are not using any function from API10 which is not present in the older APIs.

您仍然可以通过反射使用新函数.先检查函数是否可用,然后反射执行.

You can still use the new functions with reflection. First check if the function is available, then execute it with reflection.

示例:

    // try to override the transition animation
    if (VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT) {
      try {
        Method method = getClass().getMethod("overridePendingTransition",
            new Class[]{int.class, int.class});
        method.invoke(this, 0, 0);
      } catch (Throwable e) {
        // can not override transition animation, so do nothing
      }
    }

还要确保您设置了 android:minSdkVersion.

Also make sure you set android:minSdkVersion.

这篇关于在 API 10 上开发 Android 应用程序 - 它仍会在具有 API 7 的设备上运行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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