1

I'm trying to rebuild my Qt app for android, so I choose necessitas. But when I tried linking with openal soft for android(which is staticly build), errors raised:

/media/Files/QtCode/AndroidPlayer/libs/armeabi/libopenal.a(android.o): In function `JNI_OnLoad':
/media/Files/openal-android/android/jni/../../Alc/backends/android.c:51: multiple definition of `JNI_OnLoad'
qtmain_android.o:qtmain_android.cpp:(.text.JNI_OnLoad+0x0): first defined here
collect2: ld returned 1 exit status

I haven't learned android or java programming, so I don't know how to link a shared library without .a file (openal soft shared library only offers .so file).

Giorgos Dimtsas
  • 12,019
  • 3
  • 29
  • 40
Roy Willow
  • 21
  • 6

1 Answers1

0

That means JNI_OnLoad function is defined in multiple places. Once in android.c file from OpenAL Soft, and once in qtmain_android.cpp from Qt.

JNI_OnLoad is special function that Android calls for each shared library when it gets load. Obviously you cann't have two of those.

I suggest you putting OpenAL and Qt into seperate shared libraries. That way Android will call both JNI_OnLoad functions correctly.

Mārtiņš Možeiko
  • 12,733
  • 2
  • 45
  • 45