Android文档说明:
The Build Target specifies which Android platform you’d like your
application built against.
但这究竟是什么意思呢?
我看到它的方式,我可以得到minSdkVersion = 4和targetSdkVersion = 10但是将构建目标设置为API Level 4.会发生什么? Eclipse假设我正在为API Level 4开发,任何方法,常量或任何在4级以上API级别上定义的将无法使用.如果我尝试使用它们,应用程序将无法编译.我知道这件事.
但是,让我换一种说法……
假设我只设置了minSdkVersion = 4,没有定义targetSdkVersion.我也没有使用任何方法或常量仅在4级以上的API级别上可用.在这种情况下,我选择的构建目标真的很重要吗?它会对最终的APK有什么影响吗?
解决方法
Build target
Build target is the API level Eclipse/IntelliJ/whatever IDE you’re using is building against. This
is simply used by the IDE/build system to know which APIs to offer
you. If you build against API level 14,the application will still be
able to run on API level 7,providing you don’t call any APIs that are
not available on API level 7.I mostly set the build target to the same as android:targetSdkVersion,
though this is not required.
资料来源:http://simonvt.net/2012/02/07/what-api-level-should-i-target/