为什么我在编译时不能将 android-platform 设置为低于 22?

Why I can't set android-platform lower then 22 when I compile?

当我编译由 cocos-console (cocos2d-x 3.6) 和 --ap android-16 (android platform 16) 创建的标准 hello world 项目时,它写着:

The android-platform of project "E:\projects\cocos_projects\test\proj.android" s
hould be equal/larger than 22, but 16 is specified.

在 AndroidManifest.xml 我有:<uses-sdk android:minSdkVersion="9"/>.

我在 SDK 管理器中安装了所有平台,在 ...\sdk\platforms 我有 8、10、15-22 和 MNC 文件夹。

当我修改 ...\proj.android\project.properties 时它起作用了

@Andrey 的回答基本上是正确的,但为了其他 cocos2d-x 寻找解决方法的开发人员,我会用一些缺失的信息来完成它。

此错误:

The android-platform of project "E:\projects\cocos_projects\test\proj.android" should be equal/larger than 22, but 16 is specified.

当您告诉 cocos 命令使用与您的 project properties 配置冲突的 Android API 版本 (--ap android-XX) 时,会出现

假设您的 proj.android/project.properties 是这样的:

target=android-22
android.library.reference.1=../cocos2d/cocos/platform/android/java

因此,在启动请求使用不同 Android API 版本(例如 cocos compile -p android --ap android-16)的命令之前,您应该手动编辑 project.properties 并更改target 键到与您要使用的新 Android API 版本相匹配的值。