2

I received a android build that works from someone but when I try to launch it I receive errors..

09-23 07:25:26.976: E/AndroidRuntime(336): FATAL EXCEPTION: main
09-23 07:25:26.976: E/AndroidRuntime(336): java.lang.ExceptionInInitializerError
09-23 07:25:26.976: E/AndroidRuntime(336):  at java.lang.Class.newInstanceImpl(Native Method)
09-23 07:25:26.976: E/AndroidRuntime(336):  at java.lang.Class.newInstance(Class.java:1409)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.os.Handler.dispatchMessage(Handler.java:99)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.os.Looper.loop(Looper.java:123)
09-23 07:25:26.976: E/AndroidRuntime(336):  at android.app.ActivityThread.main(ActivityThread.java:3683)
09-23 07:25:26.976: E/AndroidRuntime(336):  at java.lang.reflect.Method.invokeNative(Native Method)
09-23 07:25:26.976: E/AndroidRuntime(336):  at java.lang.reflect.Method.invoke(Method.java:507)
09-23 07:25:26.976: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-23 07:25:26.976: E/AndroidRuntime(336):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-23 07:25:26.976: E/AndroidRuntime(336):  at dalvik.system.NativeStart.main(Native Method)
09-23 07:25:26.976: E/AndroidRuntime(336): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load moai: findLibrary returned null
09-23 07:25:26.976: E/AndroidRuntime(336):  at java.lang.Runtime.loadLibrary(Runtime.java:429)
09-23 07:25:26.976: E/AndroidRuntime(336):  at java.lang.System.loadLibrary(System.java:554)
09-23 07:25:26.976: E/AndroidRuntime(336):  at com.getmoai.samples.MoaiActivity.<clinit>(MoaiActivity.java:67)
09-23 07:25:26.976: E/AndroidRuntime(336):  ... 15 more

Can anybody tell me how I can resolve this ?

Falko

user1456158
  • 841
  • 1
  • 6
  • 11

3 Answers3

2

Few things to verify...

  • Are you using the matching emulator/AVD image ? If you are using x86 based AVD, or genymotion, make sure your project is generating x86 libs. Assuming you have the source code for your NDK libraries, it is easy to generate x86 libs, along with others, just add

    APP_ABI := armeabi armeabi-v7a x86 mips

    or simply

    APP_ABI := all

    in your Application.mk (found in jni folder). If you do not have the sources (usually jni folder), test with matching device or use matching AVD emulator configuration.

  • Make sure eclipse is properly packing the native libraries with your APK. You can do this by opening the APK file (located under bin folder) as a zip file, and check if there is a lib folder and inside it x86 folder or the appropriate arch folder for the emulator/avd configuration you are using.

    • If there is a problem, for eclipse to build and package NDK based apps, you will need to download Android NDK kit, and configure NDK path in eclipse under Window -> Preferences -> Android -> NDK.
    • In Eclipse, you will also need to right-click the project and click Android Tools -> Add Native Support... for your project. Then, you should be able to properly build apps that use NDK.
ashoke
  • 6,441
  • 2
  • 26
  • 25
0

I'm suspicious to compile stuff. Please run following command from main directory of your project

gradlew clean assembledebug

This will clean your project first then tries to compile it. Hope it works.

Hesam
  • 52,260
  • 74
  • 224
  • 365
0

It seems to be just a problem with virtual devices. What it is exactly I do not know.

I managed to build and load the application on a connected android phone

user1456158
  • 841
  • 1
  • 6
  • 11