Which API should I use?

@smitpatel88 Which API should I compile using?

For example:
cocos compile -p android --ap android-"??"

PS: I’ve previously compiled my app with API 26. Is this the reason why the crash on the Galaxy S4?

26, use same as targetSdk
@erenarat pls delete obj folder, sometimes it fix crash issue.

2 Likes

OK I delete obj folder. I am trying now. :slight_smile:

@smitpatel88 We dit it! Thanks for everything. My app is running smoothly on the Galaxy S4!

PS: Will also work on a “Android 4.0.3 (API 15) device”?

Great. Welcome.

I dont have device but it should work.
But personally i dont care for less than Android 4.2

1 Like

I’m still interested in the error message in the logcat (which is now sadly gone), because now we will never know what of your steps really fixed it.

1 Like

I am using Atom Editor. I do not know how to access the error code found in logcat.

With the command line tool adb. It’s described here and will help a lot, if run into errors in the future while developing.

1 Like

what is APP_PLATFORM setting ?
also what was the reason of adding app_platform := android-19 if neither his targetSDKversion of minSDKVersion wasn’t 19 ? @smitpatel88

To avoid crash on below api-19 devices.
But now we are using Android-studio and in default template APP_PLATFORM := android-15 is added and its working fine.

@smitpatel88 what were you guys using at the time of this post eclipse ?, where could I find the default template ? I cant find APP_PLATFORM, I only see this in gradle.properties ?35%20PM

The APP_PLATFORM setting has to be in the jni folder. It’s a NDK property. And this setting has always to be the minSDK (or lower). If it’s higher the code isn’t 100% compatible with older devices. So, If you set the App Platform to 19, your minSDK has also be 19 (or larger).

1 Like

No, cmd. (cocos compile …)

Its in Application.mk file inside Proj\proj.android-studio\app\jni\

I dont have it in my newly created project ? is it mandatory to have it ? whats the exact purpose of the APP_PLATFORM setting ?

Well as i told you in above post, if you are having crash issue (Means your game is not starting at launch) on below API-19 devices then this line helps it.
Try to launch your game in Android-9, 8.1, 7.1.2, 6.0, 5.1, 4.4.2
If everything is working fine then you can avoid it or try to add this line and test yourself.

does APP_PLATFORM work with only ndk-build or also CMAKE ? since the latest version of cocos2d-x switched to CMAKE