Android Question LibGDX conflict

danijel

Active Member
Licensed User
Longtime User
Hi, I want to implement LibGDX in my existing app and getting errors.
I made an example app to show my problems.

Without LibGDX everyting is ok.



At the moment i click on LibGDX in my Libraries Manager and Run in Release mode


Nothing works anymore:


if I comment Image loading then error is somewhere else


and so on.
Everything becomes null object ref.

What is going on and how to resolve this?
 

danijel

Active Member
Licensed User
Longtime User
Post errors as TEXT, not images.

Sorry about that.

Logs:

*** Service (starter) Create ***
** Service (starter) Start **
main_globals (java line: 407)
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.libgdxexample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.libgdxexample-1/lib/arm64, /data/app/com.libgdxexample-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]] couldn't find "libopenslplayer.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:989)
at java.lang.System.loadLibrary(System.java:1533)
at flm.b4a.openslplayer.OpenSLSoundPlayer.<clinit>(OpenSLSoundPlayer.java:25)
at com.libgdxexample.main._globals(main.java:407)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at com.libgdxexample.main.initializeGlobals(main.java:320)
at com.libgdxexample.main.afterFirstLayout(main.java:101)
at com.libgdxexample.main.access$000(main.java:17)
at com.libgdxexample.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
Error (Exception) java.lang.Exception: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.libgdxexample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.libgdxexample-1/lib/arm64, /data/app/com.libgdxexample-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]] couldn't find "libopenslplayer.so"
StackTrace java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.libgdxexample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.libgdxexample-1/lib/arm64, /data/app/com.libgdxexample-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/vendor/lib64, /product/lib64]]] couldn't find "libopenslplayer.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:989)
at java.lang.System.loadLibrary(System.java:1533)
at flm.b4a.openslplayer.OpenSLSoundPlayer.<clinit>(OpenSLSoundPlayer.java:25)
at com.libgdxexample.main._globals(main.java:407)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at com.libgdxexample.main.initializeGlobals(main.java:320)
at com.libgdxexample.main.afterFirstLayout(main.java:101)
at com.libgdxexample.main.access$000(main.java:17)
at com.libgdxexample.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
** Activity (main) Create, isFirst = true **
Dim IU
Init BMP1
main_activity_create (java line: 363)
java.lang.NullPointerException: Attempt to invoke virtual method 'void flm.b4a.openslplayer.OpenSLSoundPlayer.Initialize(int, boolean)' on a null object reference
at com.libgdxexample.main._activity_create(main.java:363)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at com.libgdxexample.main.afterFirstLayout(main.java:104)
at com.libgdxexample.main.access$000(main.java:17)
at com.libgdxexample.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
Error (NullPointerException) java.lang.NullPointerException: Attempt to invoke virtual method 'void flm.b4a.openslplayer.OpenSLSoundPlayer.Initialize(int, boolean)' on a null object reference
StackTrace java.lang.NullPointerException: Attempt to invoke virtual method 'void flm.b4a.openslplayer.OpenSLSoundPlayer.Initialize(int, boolean)' on a null object reference
at com.libgdxexample.main._activity_create(main.java:363)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:191)
at com.libgdxexample.main.afterFirstLayout(main.java:104)
at com.libgdxexample.main.access$000(main.java:17)
at com.libgdxexample.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:761)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:156)
at android.app.ActivityThread.main(ActivityThread.java:6523)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
** Activity (main) Resume **
 
Upvote 0

danijel

Active Member
Licensed User
Longtime User
Yes Erel,

It have been tested on 4 different real device:
HUAWEI VNS-L21, ARM64-v8a (64-bit) - (FAILS)
LGE LG-H815, ARM64-v8a (64-bit) - (FAILS)
HTC Desire 601, armeabi-v7a (32-bit) - (WORKS)
Prestigio PMP5770D, armeabi-v7a, armeabi (32-bit) - (WORKS)

and BlueStacks Android Emulator:
SAMSUNG-SM-N900A x86, armeabi-v7a (32-bit) - (WORKS)


My conclusion is that the conflict is generated on 64-bit devices and fails to load .so library
After research I found this:
https://stackoverflow.com/questions...es-on-64-bit-android-device/30799825#30799825

If so, is there way to workaround this and force 32-bit native libraries on 64-bit Android device using B4A.
 
Upvote 0

danijel

Active Member
Licensed User
Longtime User
libopenslplayer.so is missing from folders:

\lib\arm64-v8a
  • libgdx.so
  • libgdx-box2d.so
  • libgdx-freetype.so

\lib\armeabi
  • libgdx.so
  • libgdx-box2d.so
  • libgdx-freetype.so
  • libopenslplayer.so

\lib\armeabi-v7a
  • libgdx.so
  • libgdx-box2d.so
  • libgdx-freetype.so
  • libopenslplayer.so

\lib\x86
  • libgdx.so
  • libgdx-box2d.so
  • libgdx-freetype.so

\lib\x86_64
  • libgdx.so
  • libgdx-box2d.so
  • libgdx-freetype.so
Basically I just need some good graphics library to rotate 1 image (wheel) at constant rate of 60 FPS.
I tried GameView Lib with timer but that wasn't so smooth on all devices.

Then I moved to LibGDX and animation is great but having conflict with other libraries.
So you are saying its easier to move on XUI2D than try to fix this conflict?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I tried GameView Lib with timer but that wasn't so smooth on all devices.
GameView is no longer relevant.

XUI2D is a good option. It is also cross platform.

About the error, you can delete all of the folders except of armeabi (from the library jar). It will then work.
 
Upvote 0

danijel

Active Member
Licensed User
Longtime User
Thank you Erel, after deleting it works on all tested phones.
BTW i saved 2MB
So, no phone will be impacted with deleting this folders?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…