Question

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)

Was it helpful?

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.

OTHER TIPS

The only way would be to temporarily remove the Bump Libraries and Bump related code from your app when running on the emulator, or make a duplicate app that has Bump removed from it (specifically for running on x86). Even if you were able to disable the bump libraries android would still attempt to execute any code that uses those libraries, such as import com.bump.api.IBumpAPI; which would result in a crash anyways =(

Why not create a custom library in C using JNI, to satisfy the link dependency, and use it in your project targetting the emulator?

Its akin to creating a pseudo wrapper or a shim - for example: a function in Java called fooBar which is used by the real library targetting ARM, it may have parameters etc and returns something. In the pseudo artifical library, create one with fooBar, using the same parameters and return zero or dummy object, targetting the Emulator.

It may sound awfully awkward considering the API and parameters, function names etc, that is top-of-my-head. Just to be aware that by going down this route, the task will depend on how big is the API used and governed by the Bump library, am talking about the native .so compiled ARM version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top