The way I see it, I can have the minSdkVersion=4 and targetSdkVersion=10 but set the build target to API Level 4. What will happen? Eclipse assumes I'm developing for API Level 4 and any method, constant or whatever defined on API Levels above 4 will not be available to me. If I try to use them, the application will not compile.
当你设置生成目标API级别4,由于Eclipse严格使用API级别4,因此Eclipse不会让您编译任何使用高于此级别的方法。但是,如果将构建目标设置为更高的API级别,则在您的API级别10级别中,您的APK可用于手机从API级别4到10.
第二个问题的答案会回答您的问题,即Android构建目标,minSdkVersion
和targetSdkVersion
都会影响能够使用您的应用程序的用户范围。
编辑:
既然你不会去定义targetSdkVersion
和你不使用它上面的API级别4的任何功能,该targetSdkVersion
将是一样minSdkVersion
。无论您选择何种构建目标,都会自动指定。它并不真正的问题,其建设目标由你挑,除非它低于API级别4
从targetSdkVersion
Android文档:
An integer designating the API Level that the application targets. If not set, the default value equals that given to minSdkVersion. This attribute informs the system that you have tested against the target version and the system should not enable any compatibility behaviors to maintain your app's forward-compatibility with the target version. The application is still able to run on older versions (down to minSdkVersion).
这仍然没有真正回答我的问题。 – 2012-03-27 23:58:23
我提到过,如果你只想限制到API 4,那么没有目标是好的,但是如果你选择一个更高的构建目标,并且不使用任何新功能,它可能可以在更高的API上工作,使用这些函数,但因为你没有使用它们,所以没关系。我期望字节码有所不同,以便它可以使用不同的API。 – 2012-03-28 01:23:43