How to Build a Cocos2d-x Android App for Multiple Architectures

If you have ever tried to run a Cocos2d-x app in an Android emulator, you might be familiar with this error: INSTALL_FAILED_NO_MATCHING_ABIS. This happens because your emulator is using one architecture while your app is compiled for a different architecture. Specifically, most people use x86 Android emulators, because they’re faster than their ARM counterparts. In Cocos2d-x 3.15.1, the default architecture is armeabi. Let’s explore how to fix this.

The Fix

We need to tell our project to compile for other architectures. In order to do so, we need to edit two files. First, head over to your Open it up and find this line.

APP_ABI := armeabi

Change it to the following.

APP_ABI := armeabi armeabi-v7a x86

Now find your, and locate the following line.


Add the other architectures, separated by colons, and we’re good to go!


Time to Recompile

Open up Terminal and navigate to your project’s directory. Type in the following.

cocos compile -pandroid —android-studio

Note that you might see other people specify building for a specific architecture as part of this command. We don’t need to do that here. The changes we just made will allow us to build for multiple architectures within a single APK file. This build will take about three times longer, since we’re building for three times as many architectures. Watch as the lines zip by on the Terminal window. You’ll see it build everything for armeabi first, just like it always did. Then followed by repeating all the same classes for armeabi-v7a, then the same for x86.

Now you have a debug APK file. You can drag it into your x86 emulator and watch it run! When you’re ready to deploy your app out in the wild, open your Build menu in Android Studio and select Generate Signed APK. The release APK will be ready to go!

Some Final Thoughts

After you add the extra architectures, your APK size will increase. This could present an issue if you’re trying to stay under 100MB, and this pushes you over the threshold. Don’t worry—you have options! You can use multiple APK files to handle different architectures. They need to have the same package name and be signed with the same code, but they should have different version numbers. You can read Google’s instructions for handling multiple APKs here.

Setting up Cocos2d-x in Android is trickier than iOS. If you found your way here trying to troubleshoot the INSTALL_FAILED_NO_MATCHING_ABIS error, I hope you’re back on track!