懒人目前不支持java调用所以在此贡献一个本人实现的插件支持android java层调用,具体源码下载地址:https://share.weiyun.com/ep9yKo2R
属性android的朋友可以进行二次开发,做出任何想要的功能
libjavacaller = require("libjavacaller")
local apkpath = getWorkPath().."/plug.apk"
extractAssets("懒人java调用.rc",getWorkPath(),"plug.apk")
--插件初始化,这里必须指定工作目录其它目录无效
libjavacaller.init(getWorkPath())
--注册插件apk
local apkid = libjavacaller.registerApk(apkpath)
--下面是调用例子
local isplugin = libjavacaller.invokeWithBoolean(apkid,"com/example/plug/Plugin","isPlugin")
local sum = libjavacaller.invokeWithInt(apkid,"com/example/plug/Plugin","add",1,2)
local reply = libjavacaller.invokeWithString(apkid,"com/example/plug/Plugin","sayHello","hello")
local jnireply = libjavacaller.invokeWithString(apkid,"com/example/plug/Plugin","callJni")
local systemtime = libjavacaller.invokeWithFloat(apkid,"com/example/plug/Plugin","getSystemTime")
print("call java isPlugin:",isplugin)
print("call java add:",sum)
print("call java sayHello:",reply)
print("call java getSystemTime:",systemtime)
|