Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » UnsatisfiedLinkError on Android on Allegro

This thread is locked; no one can reply to it. rss feed Print
UnsatisfiedLinkError on Android on Allegro
beoran
Member #12,636
March 2011

I'm still trying to compile the Allegro examples, but I'm getting the following error in the Android logs when starting the examples:

java.lang.UnsatisfiedLinkError: No implementation found for boolean org.liballeg.android.AllegroActivity.nativeOnCreate() (tried Java_org_liballeg_android_AllegroActivity_nativeOnCreate and Java_org_liballeg_android_AllegroActivity_nativeOnCreate__)

What could cause this? My phone has a 64 bits ARM architecture, if that helps. Strangely, some applications seem to work and some don't. I'm pretty much stumped.

Elias
Member #358
May 2000

Note that the Allegro build already compiles all the examples for you... in fact in the build folder you should find a gradle project for each of them which you can just build with gradle (or even open in Android Studio).

And then compare to what you are doing.

[edit:] Or just post your build files here and I can have a look. It sounds to me like you forgot to include the Allegro.aar library in your build.gradle.

--
"Either help out or stop whining" - Evert

beoran
Member #12,636
March 2011

Sorry, I forgot to mention, I'm already using the new Allegro 5.3.2 build system. I'm using the following commands to build and run the examples:

cmake -DCMAKE_TOOLCHAIN_FILE=../../../../cmake/Toolchain-android.cmake -DCMAKE_BUILD_TYPE=Debug -DANDROID_TARGET=android-26 -DARM_TARGETS=arm64-v8a ../../../..
make run_ex_draw_bitmap

Android relevant environment settings:

env | grep android
ANDROID_HOME=/home/beoran/opt/android/sdk
ANDROID_NDK_TOOLCHAIN_ROOT=/home/beoran/opt/android/toolchain/api21-arm64
OLDPWD=/home/beoran/src/allegro5/build/android/arm64
PATH=/home/beoran/.local/share/umake/bin:/home/beoran/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/beoran/.rvm/bin:/home/beoran/opt/jdk/bin:/home/beoran/opt/maven/bin:/home/beoran/opt/go/bin:/home/beoran/.rvm/bin:/home/beoran/opt/android/sdk/platform-tools/:/home/beoran/opt/android/toolchain/api21-arm64/bin
PWD=/home/beoran/src/allegro5/build/android/arm64/api21

The strange thing is is that at first, the example compiled and ran correctly, but then after I tried it again when I made some modifications to implement haptics support, it stopped working. I can show the diff of my work, but it's really unrelated to ex_draw_bitmap, so I don't know how that could cause the unsatisfied linker error. If there's anything else you need to know please ask and I'll do my best to show you.

Elias
Member #358
May 2000

I think if you use api21 toolchain you should use android-21 as target as well.

[edit:] Also, can you post the directory listing of your ex_draw_bitmap.apk (especially the native libraries folder), and the complete logcat of running the apk?

--
"Either help out or stop whining" - Evert

beoran
Member #12,636
March 2011

I tried a bit more and I guess it must probably be due to my be my changes, because make run_ex_draw_bitmap does work well on a clean clone of the Allegro5 git repository.

I have attached the diff between current master and my branch. My branch beoran-android-haptics is also online on github at http://github.com/beran/allegro5.

The error traceback I am getting trough adb:

#SelectExpand
111-22 15:27:35.615 17057 17057 E AndroidRuntime: FATAL EXCEPTION: main 211-22 15:27:35.615 17057 17057 E AndroidRuntime: Process: org.liballeg.ex_draw_bitmap, PID: 17057 311-22 15:27:35.615 17057 17057 E AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for boolean org.liballeg.android.AllegroActivity.nativeOnCreate() (tried Java_org_liballeg_android_AllegroActivity_nativeOnCreate and Java_org_liballeg_android_AllegroActivity_nativeOnCreate__) 411-22 15:27:35.615 17057 17057 E AndroidRuntime: at org.liballeg.android.AllegroActivity.nativeOnCreate(Native Method) 511-22 15:27:35.615 17057 17057 E AndroidRuntime: at org.liballeg.android.AllegroActivity.onCreate(AllegroActivity.java:327) 611-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6309) 711-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 811-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2665) 911-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:179) 1011-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1499) 1111-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:111) 1211-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.os.Looper.loop(Looper.java:207) 1311-22 15:27:35.615 17057 17057 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5765) 1411-22 15:27:35.615 17057 17057 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 1511-22 15:27:35.615 17057 17057 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 1611-22 15:27:35.615 17057 17057 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)

Listing of the contents of the apk file:

#SelectExpand
1unzip -vM examples/ex_draw_bitmap.project/app/build/outputs/apk/debug/app-debug.apk 2Archive: examples/ex_draw_bitmap.project/app/build/outputs/apk/debug/app-debug.apk 3 Length Method Size Cmpr Date Time CRC-32 Name 4-------- ------ ------- ---- ---------- ----- -------- ---- 5 1740 Defl:N 733 58% 1980-00-00 00:00 70ea9d49 AndroidManifest.xml 6 1203 Defl:N 1064 12% 1980-00-00 00:00 cfc2ff8d META-INF/CERT.RSA 7 2462 Defl:N 1078 56% 1980-00-00 00:00 cf3d9c9d META-INF/CERT.SF 8 2425 Defl:N 1048 57% 1980-00-00 00:00 d06d7c37 META-INF/MANIFEST.MF 9 53181 Defl:N 6220 88% 1980-00-00 00:00 bf45a125 assets/data/a4_font.tga 10 11626 Defl:N 8510 27% 1980-00-00 00:00 a7b3121c assets/data/alexlogo.bmp 11 6959 Stored 6959 0% 1980-00-00 00:00 baabb656 assets/data/alexlogo.png 12 43782 Defl:N 29889 32% 1980-00-00 00:00 dd2c268d assets/data/allegro.pcx 13 9367 Stored 9367 0% 1980-00-00 00:00 1a83a640 assets/data/bkg.png 14 59209 Defl:N 3395 94% 1980-00-00 00:00 2cef749e assets/data/bmpfont.tga 15 416 Defl:N 149 64% 1980-00-00 00:00 f6a2b3eb assets/data/cursor.tga 16 180054 Defl:N 47087 74% 1980-00-00 00:00 7a41e0d3 assets/data/fakeamp.bmp 17 25839 Defl:N 2618 90% 1980-00-00 00:00 6d94f76e assets/data/fixed_font.tga 18 36537 Defl:N 4609 87% 1980-00-00 00:00 312018d2 assets/data/font.tga 19 6729 Stored 6729 0% 1980-00-00 00:00 2c655844 assets/data/haiku/air_effect.png 20 9260 Defl:N 640 93% 1980-00-00 00:00 c2818bac assets/data/icon.tga 21 61581 Defl:N 34318 44% 1980-00-00 00:00 66a0f94d assets/data/mysha.pcx 22 65579 Stored 65579 0% 1980-00-00 00:00 dc8db69c assets/data/mysha256x256.png 23 29476 Stored 29476 0% 1980-00-00 00:00 53fdff87 assets/data/obp.jpg 24 6383 Defl:N 1737 73% 1980-00-00 00:00 5e475087 assets/data/texture.tga 25 90804 Defl:N 26734 71% 1980-00-00 00:00 263e2bea classes.dex 26 1175416 Defl:N 338763 71% 1980-00-00 00:00 9f392a5d lib/arm64-v8a/liballegro-debug.so 27 22440 Defl:N 8938 60% 1980-00-00 00:00 7a0ad3cc lib/arm64-v8a/liballegro_acodec-debug.so 28 113184 Defl:N 38158 66% 1980-00-00 00:00 685af112 lib/arm64-v8a/liballegro_audio-debug.so 29 29824 Defl:N 10755 64% 1980-00-00 00:00 e4ad0009 lib/arm64-v8a/liballegro_color-debug.so 30 34976 Defl:N 14108 60% 1980-00-00 00:00 692dd66e lib/arm64-v8a/liballegro_font-debug.so 31 55320 Defl:N 20174 64% 1980-00-00 00:00 60ad00b3 lib/arm64-v8a/liballegro_image-debug.so 32 5592 Defl:N 1182 79% 1980-00-00 00:00 44d02d56 lib/arm64-v8a/liballegro_main-debug.so 33 9936 Defl:N 2599 74% 1980-00-00 00:00 35bb648a lib/arm64-v8a/liballegro_memfile-debug.so 34 105096 Defl:N 39191 63% 1980-00-00 00:00 46c9e46b lib/arm64-v8a/liballegro_primitives-debug.so 35 22648 Defl:N 7617 66% 1980-00-00 00:00 f0d1a2ee lib/arm64-v8a/libnative-lib.so 36 384 Stored 384 0% 1980-00-00 00:00 ecf007cb resources.arsc 37-------- ------- --- ------- 38 2279428 769808 66% 32 files

I have also attached the apk file so you can inspect it.

Elias
Member #358
May 2000

Hm, that apk isn't recognized as runnable on my phone. I'll try your haptics branch but stuck at Thanksgiving dinners today and flying to Europe tomorrow... So might be a while.

--
"Either help out or stop whining" - Evert

beoran
Member #12,636
March 2011

Probably your phone has a different native architecture. And no problem, I also have a busy private life, I do appreciate your efforts. Meanwhile I will investigate more by myself as well.

Go to: