There have been a number of press-releases about upcoming Android Wear devices containing Intel x86 processors. Some developers have been building applications for Android Wear using the NDK, and providing only armeabi-v7a shared libraries in their wearable APK. With the impending arrival of these new Intel x86 wearables, APKs built for only ARM will fail on these new devices.Note: if you are only working with Java code, there is nothing to do here, since your APKs are in portable bytecode, and will work on any architecture. You only need to read this if you are using the NDK.
So what do you need to do to add support for x86? It is very easy. You simply need to edit your build.gradle for the wearable module to include both armeabi-v7a and
x86 in your abiFilters, and then recompile. Gradle will then build a combined wearable APK, which contains binaries for both architectures. The wearable APK is then embedded into the regular phone APK, as usual.
I have an open source project where you can see how the build process works. The wear/build.gradle file contains the following now:
abiFilters = ['armeabi-v7a','x86']
You can see the build.gradle file, and the rest of the GitHub project, here:https://github.com/waynepiekarski/android-glider/blob/x86/wear/build.gradle#L13-L18
How can you determine if your final APK is built correctly? Firstly, you should unzip the phone APK. Then, unzip the embedded wearable APK located in res/raw. There should be two binary .so files, where "native-jni" will be replaced with whatever you used in moduleName in your build.gradle:
If you find yourself in a situation where your wearable APK will still not install, you should check adb logcat on the wearable device. If there are problems caused by not having the right ABI binaries present, you will get the error INSTALL_FAILED_NO_MATCHING_ABIS represented as code -113 in the logcat output:
W/NativeHelper( 457): Failure copying native libraries [errorCode=-113]
E/WearablePkgInstaller( 1568): Package install failed null, returnCode -113
If you have any more questions about this, please discuss it on this post.