question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

android: Couldn't load shared library 'gdx' for target: Linux, 32-bit

See original GitHub issue

Issue details

hi, I create my first project with libgdx it’s cool and work nice on desktop but when i want to run it on android give me a error. I develop on mac and use intellij

Version of LibGDX and/or relevant dependencies

Gdx version: 1.9.8

Stacktrace

    java.lang.ExceptionInInitializerError
        at java.lang.Class.newInstanceImpl(Native Method)
        at java.lang.Class.newInstance(Class.java:1319)
        at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
        at android.app.ActivityThread.access$600(ActivityThread.java:156)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:153)
        at android.app.ActivityThread.main(ActivityThread.java:5299)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
        at dalvik.system.NativeStart.main(Native Method)
     Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx' for target: Linux, 32-bit
        at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:125)
        at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:33)
        at com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication.java:63)
        at java.lang.Class.newInstanceImpl(Native Method) 
        at java.lang.Class.newInstance(Class.java:1319) 
        at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 
        at android.app.ActivityThread.access$600(ActivityThread.java:156) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:153) 
        at android.app.ActivityThread.main(ActivityThread.java:5299) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:511) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
        at dalvik.system.NativeStart.main(Native Method) 
     Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gdx from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/ir.sadeghpro.game-1.apk"],nativeLibraryDirectories=[/data/app-lib/ir.sadeghpro.game-1, /vendor/lib, /system/lib]]]: findLibrary returned null
        at java.lang.Runtime.loadLibrary(Runtime.java:359)
        at java.lang.System.loadLibrary(System.java:514)
        at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:119)
        at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:33) 
        at com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication.java:63) 
        at java.lang.Class.newInstanceImpl(Native Method) 
        at java.lang.Class.newInstance(Class.java:1319) 
        at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2223) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358) 
        at android.app.ActivityThread.access$600(ActivityThread.java:156) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1340) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:153) 
        at android.app.ActivityThread.main(ActivityThread.java:5299) 
        at java.lang.reflect.Method.invokeNative(Native Method) 
        at java.lang.reflect.Method.invoke(Method.java:511) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
        at dalvik.system.NativeStart.main(Native Method) 

Please select the affected platforms

  • [ * ] Android
  • iOS (robovm)
  • iOS (MOE)
  • HTML/GWT
  • Windows
  • Linux
  • MacOS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
fanqazcommented, Dec 26, 2018

.so文件没有。需要在Terminal 中运行 gradlew fetchNatives

这个task在项目下面的build.gradle里。如下: task fetchNatives { doLast { ant.importBuild “fetch.xml” fetch.execute() copy.execute()

}

}

2reactions
Tom-Skicommented, Nov 2, 2018

Use the android:copyNatives Task located in the android/build.gradle file

Read more comments on GitHub >

github_iconTop Results From Across the Web

Couldn't load shared library 'gdx' for target - Stack Overflow
The problem I had was that for some reason libgdx.so was not copied to any of the armeabi , armeabi-v7a or x86 folders...
Read more >
Thread: Loading freetype.so says dlopen failed, could not build
The console says couldn't load shared library gdx-freetype for target linux 32-bit. I feel like I have tried everything.
Read more >
Couldn't load shared library 'gdx' for target: Linux, 32-bit
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx' for target: Linux, 32-bit. at com.badlogic.gdx.utils.
Read more >
libgdx, couldn't load shared library 'gdx' for target: Linux, 32-bit的 ...
說在前面的話今天在下載spine-libgdx的spine-libgdx-tests運行時,報了一個“libgdx, couldn't load shared library 'gdx' for target: Linux, 3.
Read more >
com.badlogic.gdx.utils.SharedLibraryLoader.java Source code
Here is the source code for com.badlogic.gdx.utils. ... ZipFile; /** Loads shared libraries from a natives jar file (desktop) or arm folders (Android)....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found