Search code examples
androidandroid-x86bump

How can I disable loading of libraries when running the Android Emulator?


So I have started developing for Bump, and in their short-sightedness they don't support x86 based Android devices/emulators. Only ARM.

Well, setting the small market aside, it's a big problem for me since I thoroughly enjoy developing using the x86 based emulator for performance reasons.

So, (since Bump is pointless on an emulator anyway) how can I disable the loading of the Bump libraries when running in the emulator?

import com.bump.api.IBumpAPI;
import com.bump.api.BumpAPIIntents;

Error:

08-06 17:58:30.895: E/AndroidRuntime(1799): java.lang.UnsatisfiedLinkError: Couldn't load android-api from loader dalvik.system.PathClassLoader[dexPath=/data/app/com.xxxxxxxx-2.apk,libraryPath=/data/app-lib/com.xxxxxxxxx-2]: findLibrary returned null 08-06 17:58:30.895: E/AndroidRuntime(1799): at java.lang.Runtime.loadLibrary(Runtime.java:365) 08-06 17:58:30.895: E/AndroidRuntime(1799): at java.lang.System.loadLibrary(System.java:535) 08-06 17:58:30.895: E/AndroidRuntime(1799): at com.bump.api.BumpAPI.(BumpAPI.java:122) 08-06 17:58:30.895: E/AndroidRuntime(1799): at java.lang.Class.newInstanceImpl(Native Method) 08-06 17:58:30.895: E/AndroidRuntime(1799): at java.lang.Class.newInstance(Class.java:1319)


Solution

  • While somewhat complex, you can achieve this by splitting your project up into several related projects using an android library project. Currently you probably have something like this

    1. Main project - Includes all code, bump libraries, etc. This is what you run on devices

    You will need to split your app into 3 seperate projects:

    1. Library project - This will includes almost all the code in the original main project, with the exception of the bump library and related code.

    2. Device project - This will depend on the library project and adds the bump library and related activities. This is what you run on devices.

    3. Emulator project - This will depend on the library project. The bump library and activities are not included. This is what you run in the emulator.

    The theory is the same as having a paid and a free version of your app. Except instead of paid and free, you have bump and non-bump.