├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── libraries │ ├── animated_vector_drawable_25_0_0.xml │ ├── appcompat_v7_25_0_0.xml │ ├── espresso_core_2_2_2.xml │ ├── espresso_idling_resource_2_2_2.xml │ ├── exposed_instrumentation_api_publish_0_5.xml │ ├── hamcrest_core_1_3.xml │ ├── hamcrest_integration_1_3.xml │ ├── hamcrest_library_1_3.xml │ ├── javawriter_2_1_1.xml │ ├── javax_annotation_api_1_2.xml │ ├── javax_inject_1.xml │ ├── jsr305_2_0_1.xml │ ├── junit_4_12.xml │ ├── luajava_1_0.xml │ ├── rules_0_5.xml │ ├── runner_0_5.xml │ ├── support_annotations_25_0_0.xml │ ├── support_compat_25_0_0.xml │ ├── support_core_ui_25_0_0.xml │ ├── support_core_utils_25_0_0.xml │ ├── support_fragment_25_0_0.xml │ ├── support_media_compat_25_0_0.xml │ ├── support_v4_25_0_0.xml │ └── support_vector_drawable_25_0_0.xml ├── markdown-navigator.xml ├── markdown-navigator │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── plusub │ │ └── androidluaexample │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── ObjectAlgorithm.lua │ ├── java │ └── com │ │ └── plusub │ │ └── androidluaexample │ │ ├── MainActivity.java │ │ └── StringUtils.java │ └── res │ ├── layout │ ├── activity_jnitest.xml │ └── activity_main.xml │ ├── menu │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── raw │ ├── hello.lua │ ├── luafile.lua │ └── luafile1.lua │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── luajava ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── org │ │ └── keplerproject │ │ └── luajava │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── org │ │ │ └── keplerproject │ │ │ └── luajava │ │ │ ├── CPtr.java │ │ │ ├── Console.java │ │ │ ├── JavaFunction.java │ │ │ ├── LuaException.java │ │ │ ├── LuaInvocationHandler.java │ │ │ ├── LuaJavaAPI.java │ │ │ ├── LuaObject.java │ │ │ ├── LuaState.java │ │ │ └── LuaStateFactory.java │ ├── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ ├── lua │ │ │ ├── Android.mk │ │ │ ├── Makefile │ │ │ ├── lapi.c │ │ │ ├── lapi.h │ │ │ ├── lauxlib.c │ │ │ ├── lauxlib.h │ │ │ ├── lbaselib.c │ │ │ ├── lbitlib.c │ │ │ ├── lcode.c │ │ │ ├── lcode.h │ │ │ ├── lcorolib.c │ │ │ ├── lctype.c │ │ │ ├── lctype.h │ │ │ ├── ldblib.c │ │ │ ├── ldebug.c │ │ │ ├── ldebug.h │ │ │ ├── ldo.c │ │ │ ├── ldo.h │ │ │ ├── ldump.c │ │ │ ├── lfunc.c │ │ │ ├── lfunc.h │ │ │ ├── lgc.c │ │ │ ├── lgc.h │ │ │ ├── linit.c │ │ │ ├── liolib.c │ │ │ ├── llex.c │ │ │ ├── llex.h │ │ │ ├── llimits.h │ │ │ ├── lmathlib.c │ │ │ ├── lmem.c │ │ │ ├── lmem.h │ │ │ ├── loadlib.c │ │ │ ├── lobject.c │ │ │ ├── lobject.h │ │ │ ├── lopcodes.c │ │ │ ├── lopcodes.h │ │ │ ├── loslib.c │ │ │ ├── lparser.c │ │ │ ├── lparser.h │ │ │ ├── lprefix.h │ │ │ ├── lstate.c │ │ │ ├── lstate.h │ │ │ ├── lstring.c │ │ │ ├── lstring.h │ │ │ ├── lstrlib.c │ │ │ ├── ltable.c │ │ │ ├── ltable.h │ │ │ ├── ltablib.c │ │ │ ├── ltm.c │ │ │ ├── ltm.h │ │ │ ├── lua.c │ │ │ ├── lua.h │ │ │ ├── lua.hpp │ │ │ ├── luac.c │ │ │ ├── luaconf.h │ │ │ ├── lualib.h │ │ │ ├── lundump.c │ │ │ ├── lundump.h │ │ │ ├── lutf8lib.c │ │ │ ├── lvm.c │ │ │ ├── lvm.h │ │ │ ├── lzio.c │ │ │ └── lzio.h │ │ └── luajava │ │ │ ├── Android.mk │ │ │ ├── log.h │ │ │ ├── luajava.c │ │ │ └── luajava.h │ ├── jniLibs │ │ ├── arm64-v8a │ │ │ └── libluajava.so │ │ ├── armeabi-v7a │ │ │ └── libluajava.so │ │ ├── armeabi │ │ │ └── libluajava.so │ │ ├── mips │ │ │ └── libluajava.so │ │ ├── mips64 │ │ │ └── libluajava.so │ │ ├── x86 │ │ │ └── libluajava.so │ │ └── x86_64 │ │ │ └── libluajava.so │ └── res │ │ └── values │ │ └── strings.xml │ └── test │ └── java │ └── org │ └── keplerproject │ └── luajava │ └── ExampleUnitTest.java ├── old ├── AndroLua.jar └── armeabi │ └── libluajava.so └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | 39 | # Keystore files 40 | *.jks 41 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | AndroidLuaExample -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/espresso_core_2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/espresso_idling_resource_2_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/exposed_instrumentation_api_publish_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_integration_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/javawriter_2_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javax_annotation_api_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javax_inject_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/jsr305_2_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/luajava_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/rules_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/runner_0_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_compat_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_ui_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_core_utils_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_fragment_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_media_compat_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_25_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/markdown-navigator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 33 | 34 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /.idea/markdown-navigator/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 26 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 53 | 54 | C:\Users\PLUSUB\AppData\Roaming\Subversion 55 | 56 | 57 | 58 | 59 | 60 | 1.7 61 | 62 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 BlakeQu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AndroidLuaExample 2 | update to Lua 5.3.3 and LuaJava ported to Android example 3 | 4 | [![License][licence_svg]][licence_url] 5 | [![Download][bintray_svg]][bintray_url] 6 | 7 | # Import 8 | add to build.gradle,${latest.version} is [![Download][bintray_svg]][bintray_url] 9 | ``` 10 | dependencies { 11 | compile 'com.blakequ.luajava:luajava:${latest.version}' 12 | } 13 | ``` 14 | maven 15 | ``` 16 | 17 | com.blakequ.luajava 18 | luajava 19 | ${latest.version} 20 | pom 21 | 22 | ``` 23 | 24 | 25 | # How to use 26 | you can download example and study how to use. 27 | add proguard rules 28 | ``` 29 | # luajava 30 | -keep class org.keplerproject.luajava.**{*;} 31 | # For native methods 32 | -keepclasseswithmembernames class * { 33 | native ; 34 | } 35 | ``` 36 | 37 | ## 1. init lua 38 | 39 | init lua file only once after start app 40 | ``` 41 | private void initLua(){ 42 | mLuaState = LuaStateFactory.newLuaState(); 43 | mLuaState.openLibs(); 44 | //push Log object to lua, in lua using like: Log:i(TAG, "this log can show in AS logcat window") 45 | try { 46 | mLuaState.pushObjectValue(Log.class); 47 | mLuaState.setGlobal("Log"); 48 | } catch (LuaException e1) { 49 | // TODO Auto-generated catch block 50 | e1.printStackTrace(); 51 | } 52 | } 53 | ``` 54 | 55 | ## 2. add lua file to raw 56 | ``` 57 | app/src/main/res/raw/luafile.lua 58 | 59 | function GetVersion(info, intvalue) 60 | Log:i("LuaLog", info..intvalue) 61 | print('this log') 62 | return 1 63 | end 64 | ``` 65 | 66 | ## 3. invoke lua function 67 | ``` 68 | private void executeLuaFile() 69 | { 70 | mLuaState.getGlobal("GetVersion"); 71 | mLuaState.pushString("reload lua test");// input params 72 | mLuaState.pushNumber(10); 73 | mLuaState.call(2, 1);//2 input, 1 output 74 | String result = mLuaState.toString(-1); 75 | if (result == null){ 76 | System.out.println("GetVersion return empty value"); 77 | }else { 78 | System.out.println("GetVersion return value"+result); 79 | } 80 | } 81 | ``` 82 | 83 | ## 4. invoke lua and error handle 84 | ``` 85 | private void executeLuaFile2() 86 | { 87 | //in lua file not exist this method:GetNotMethod 88 | mLuaState.getGlobal("GetNotMethod"); 89 | mLuaState.pushString("reload lua test");// input params 90 | mLuaState.pushNumber(10);//not use pushInteger 91 | //if using call will throw exception(can not catch), so you must use pcall 92 | //success to invoke method if return 0, otherwise is error. 93 | int retCode = mLuaState.pcall(2, 1, -1);//2 input, 1 output 94 | String result = mLuaState.toString(-1); 95 | if (retCode != 0){ 96 | LogUtils.e(TAG, "Fail to invoke GetNotMethod by lua errorCode:"+retCode+" errorMsg:"+result); 97 | }else { 98 | if (result == null){ 99 | System.out.println("GetVersion return empty value"); 100 | }else { 101 | System.out.println("GetVersion return value"+result); 102 | } 103 | } 104 | } 105 | ``` 106 | 107 | # Link 108 | - [AndroLua-mkottman](https://github.com/mkottman/AndroLua) 109 | - [AndroLua-new](https://github.com/lendylongli/AndroLua) 110 | - [LuaScriptCore](https://github.com/vimfung/LuaScriptCore) 111 | 112 | 113 | [bintray_svg]: https://api.bintray.com/packages/haodynasty/maven/AndroidLua/images/download.svg 114 | [bintray_url]: https://bintray.com/haodynasty/maven/AndroidLua/_latestVersion 115 | [licence_svg]: https://img.shields.io/badge/license-Apache%202-green.svg 116 | [licence_url]: https://www.apache.org/licenses/LICENSE-2.0 117 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion '25.0.0' 6 | defaultConfig { 7 | applicationId "com.plusub.androidluaexample" 8 | minSdkVersion 18 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | signingConfig signingConfigs.debug 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | tasks.withType(JavaCompile) { 23 | options.encoding = "UTF-8" 24 | } 25 | 26 | dependencies { 27 | // compile fileTree(dir: 'libs', include: ['*.jar']) 28 | // compile project(':luajava') 29 | compile 'com.blakequ.luajava:luajava:1.0' 30 | compile 'com.android.support:appcompat-v7:25.0.0' 31 | } 32 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\studio_sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # luajava 20 | -keep class org.keplerproject.luajava{*;} 21 | # For native methods 22 | -keepclasseswithmembernames class * { 23 | native ; 24 | } 25 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/plusub/androidluaexample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.plusub.androidluaexample; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/assets/ObjectAlgorithm.lua: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haodynasty/AndroidLuaExample/f51699da7c2a07e8c7ddc4ebb3fd29a5cccf0f45/app/src/main/assets/ObjectAlgorithm.lua -------------------------------------------------------------------------------- /app/src/main/java/com/plusub/androidluaexample/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.plusub.androidluaexample; 2 | 3 | /** 4 | * Copyright (C) BlakeQu All Rights Reserved 5 | *

6 | * Licensed under the blakequ.com License, Version 1.0 (the "License"); 7 | * Unless required by applicable law or agreed to in writing, software 8 | * distributed under the License is distributed on an "AS IS" BASIS, 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | * See the License for the specific language governing permissions and 11 | * limitations under the License. 12 | *

13 | * author : quhao
14 | * date : 2017/2/15 14:57
15 | * last modify author :
16 | * version : 1.0
17 | * description: 18 | */ 19 | 20 | public class StringUtils { 21 | 22 | public static boolean isEmpty(String str){ 23 | if (str == null || str.length() == 0) return true; 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_jnitest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 |