gudzpoz / luajava

Lua for Java on Windows, Mac OS X, Linux, Android. 5.1, 5.2, 5.3, 5.4, LuaJ or LuaJIT.
https://gudzpoz.github.io/luajava/
Other
143 stars 17 forks source link

Example was broken. #13

Closed leasses closed 2 years ago

leasses commented 2 years ago

Could you please make a LuaJIT example with Android Studio?

And when I ran the examples, I got an expection:


C:\Users\Administrator>java -jar D:\Downloads\Misc\example-all.jar
Lua Version: jit
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to find natives or init
        at party.iroiro.luajava.LuaJit.getNatives(LuaJit.java:24)
        at party.iroiro.luajava.LuaJit.<init>(LuaJit.java:11)
        at party.iroiro.luajava.Console.getLua(Console.java:87)
        at party.iroiro.luajava.Console.startInteractive(Console.java:39)
        at party.iroiro.luajava.Console.main(Console.java:31)

But if I try the other lua versions, it works.

gudzpoz commented 2 years ago

Thank you for reporting! This should have been fixed by https://github.com/gudzpoz/luajava/commit/d3aef0405fb4c85ec164c5218a3698089a6ecc0d. Could you please try again with the latest release?

I assume you use Gradle in your Android Studio projects, and in this case, pasting the following into the dependencies section in your build.gradle should add LuaJIT to the dependencies.

implementation 'party.iroiro.luajava:luajava:3.0.2'
implementation 'party.iroiro.luajava:luajit:3.0.2'
implementation 'party.iroiro.luajava:luajit-platform:3.0.2:natives-armeabi-v7a'
implementation 'party.iroiro.luajava:luajit-platform:3.0.2:natives-arm64-v8a'
implementation 'party.iroiro.luajava:luajit-platform:3.0.2:natives-x86'
implementation 'party.iroiro.luajava:luajit-platform:3.0.2:natives-x86_64'

You may want to check out the initializer and the Hello World example.

leasses commented 2 years ago

Well, the example was fixed. But there are still some problems to support Android Studio, so I want to new an issue and close this one.