Skip to content

Commit

Permalink
edited Cocos command modifications (#16567)
Browse files Browse the repository at this point in the history
  • Loading branch information
slackmoehrle authored and minggo committed Sep 13, 2016
1 parent 3075108 commit 290a124
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions docs/RELEASE_NOTES.md
Expand Up @@ -28,26 +28,37 @@
* application will crash if using SimpleAudioEngine or new AudioEngine to play audio on Android 2.3.x
* object.setString() has not effect if passing a number on JSB

## Cocos command modification
## Cocos command modifications

In previous, cocos command will find an Android API level >= specified Android API level to build source codes on Android. For example, if the content of `APP_ROOT/proj.android/project.properties` is
Prior to `v3.13` the __cocos__ command would find an Android API level __>=__ a specified
Android API level inorder to build source codes on Android. For example, if the contents of
__APP_ROOT/proj.android/project.properties__ is:

```
target=android-13 // the default android api level
android.library.reference.1=../../../cocos/platform/android/java
```
then cocos command will find `android-13` in `ANDROID_SDK_ROOT/platforms`, if not found then it will find `android-14`, if `android-14` is not found, then it will find `android-15` and so on until it found one.

This algorithm has a problem that if you only download Android 21, then application will be built with Android 21 though the default API level is 13. If the application runs on a device with lower Android OS(such as Android 4.0), then the application may crash. Building with high API level Android SDK can not make sure run on devices with low Android OS. It is reasonable, an applicatoin build with iOS 9 can not make sure run on iOS 8.
then the __cocos__ command will find __android-13__ in `ANDROID_SDK_ROOT/platforms`. If __android-13__
is not found then it will try to find __android-14__. If __android-14__ is not found, then it will find
__android-15__ and so on until it finds one.

Since v3.13.1, cocos command will stop if it can not find specific API level(default is android-13). If you want to build with high level Android SDK, you should explicitely specify it like this:
This algorithm has a problem. If you only download __Android 21__, then your application will be built with
__Android 21__ even though the default API level is 13. If your application runs on a device with a lower Android OS,
such as Android 4.0, then your application may crash. Building with a higher API level does not ensure that your
application will run on devices with a lower Android OS.

```
Starting in `v3.13.1`, the __cocos__ command will stop if it can not find a specific API level. The default
is __android-13__. If you want to build with a higher level Android SDK, you should explicitely specify it.
Example:

```sh
cocos compile -p android --ap android-19
```

Keep in mind that, after running this command, content of `APP_ROOT/proj.android/project.properties` will be changed, `android-19` will be the default API level.
Keep in mind that, after running this command, the contents of `APP_ROOT/proj.android/project.properties` will
be changed, __android-19__ will now be the default API level.

There is a map between Android API level and Android OS version, can refer to [this documentation](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html) for detail information.
There is a map between Android API level and Android OS version that you can [refer to](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html) for detailed information.

Can refer to [here](https://github.com/cocos2d/cocos2d-x/milestone/33) for detail information about these issues.
There is also more detailed information in our [GitHub repo](https://github.com/cocos2d/cocos2d-x/milestone/33) about this issue.

0 comments on commit 290a124

Please sign in to comment.