How to compile Lua 5.4.0 for Android as a dynamic library using Android Studio 4

Saturday, May 30th, 2020 | Dennis D. Spreen | Android, Android Studio, Lua

This is a tutorial on how to compile Lua 5.4.0 for Android as a dynamic library (liblua.so) using the Windows Android Studio 4.

1. Download and install Android Studio 4.0 for Windows 64-bit.

2. Start a new Android Studio project.

3. Create a new empty project with No Activity

4. Name the project Lua Library, choose Java as the language and set a minimum SDK version.

5. Go to File | Settings and navigate to Appearance | System Settings and Android SDK

6. Go to the tab named SDK Tools and select the NDK (Side by Side) option and press Apply (accept the License and install it)

7. In the Project Explorer on the left navigate to the LuaLibrary | app | src folder and with right mouse button choose New | Directory and name it jni

8. On that jni-folder click the right mouse button and select New | File and name it Android.mk

9. Use default selected Text file type

and fill the newly created but empty file with

10. Repeat step 8 and create a file named Application.mk and fill it with

11. Download Lua 5.4.0 source code, extract it and copy/paste the complete lua-5.4.0 folder inside the jni folder within Android Studio project explorer

12. Open a terminal with right click on the jni folder (Open in Terminal)

13. in that terminal window type this command (you may need to adjust the path to reflect your current installed NDK version!):

14. in the LuaLibrary\app\libs folder you’ll then find the shared libraries

Tags: , ,

No comments yet.

Leave a comment

About Dennis D. Spreen

I'm an avid programmer working on a variety of platforms in a variety of languages with a wide technical interest.

Search

QR Code

Categories