I'm trying to use LuaJ in an Android Studio (V0.2.3) project.
I added the luaj-jme-3.0-beta.jar
to the libs folder.
Under "Project Structure" libraries I added the project library luaj-jme-3.0-beta.jar
.
In the build.gradle file under "dependancies" I added this line: compile files('libs/luaj-jme-3.0-beta1.jar')
In my MainActivty I call luaj:
import org.luaj.vm2.Globals;
import org.luaj.vm2.lib.jme.JmePlatform;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Globals globals = JmePlatform.standardGlobals();
}
Compiling is succesfull, then after uploading the apk file to the target device I got this message:
08-18 16:59:25.533 11363-11363/? E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: org.luaj.vm2.lib.jme.JmePlatform
at de.ibr.luaj5.MainActivity.onCreate(MainActivity.java:16)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
I use apkananyser.jar to look in the apk file. It looks like the lua lib is not include in the apk file.
Im new to gradle, so how can I add the lua lib to the apk file? I've been Googling this for two days but I can't find a solution.
How can I solve this error?