# -------------- main --------------
if __name__ == '__main__':
//这些是我们可以输入的参数,如果我们想看这些参数的含义,直接在dos命令下执行build_native.py -h
//至于为什么是这样的解析输入参数,详细可以查看python的文档,主要和OptionParser类有关。
parser = OptionParser()
parser.add_option("-n", "--ndk", dest="ndk_build_param", help='parameter for ndk-build')
parser.add_option("-p", "--platform", dest="android_platform",
help='parameter for android-update.Without the parameter,the script just build dynamic library for project. Valid android-platform are:[10|11|12|13|14|15|16|17|18|19]')
parser.add_option("-b", "--build", dest="build_mode",
help='the build mode for java project,debug[default] or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html')
(opts, args) = parser.parse_args()
//执行编译命令,下一篇分析
build(opts.ndk_build_param,opts.android_platform,opts.build_mode)
执行build_native.py -h会出现如下所示的: