M8Test Help

loadDex

package com.example.script import com.example.script.Lib // ---------------加载dex插件开始---------------------- _console.log("loadDex start") // 获取设备所有支持的ABI val abis = Lib.AbiUtils.getSupportedAbis() // Files.buildFile() 用于构建一个 ScriptFile 对象 val dexPath = _files.buildFile { // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 setRelativePath("plugin", "dex/plugindex.dex") } // Files.buildFile() 用于构建一个 ScriptFile 对象 val soPath = _files.buildFile { // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 setRelativePath("plugin", "so/${abis[0]}/") } // Plugins.loadDex() 用于将dex作为插件加载 _plugins.loadDex(dexPath, soPath, 0) _console.log("loadDex end") // ---------------加载dex插件结束----------------------
package com.example.script import com.example.script.AbiUtils // ---------------加载dex插件开始---------------------- $console.log("loadDex start") // 获取设备所有支持的ABI def abis = AbiUtils.getSupportedAbis() // Files.buildFile() 用于构建一个 ScriptFile 对象 def dexPath = $files.buildFile { // delegate -> FileBuilder // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 setRelativePath("plugin", "dex/plugindex.dex") } // Files.buildFile() 用于构建一个 ScriptFile 对象 def soPath = $files.buildFile { // delegate -> FileBuilder // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 setRelativePath("plugin", "so/${abis[0]}/") } // Plugins.loadDex() 用于将dex作为插件加载 $plugins.loadDex(dexPath, soPath, 0) $console.log("loadDex end") // ---------------加载dex插件结束----------------------
import {getSupportedAbis} from 'com/example/script/lib.js'; // ---------------加载dex插件开始---------------------- $console.log("loadDex start") // 获取设备所有支持的ABI let abis = getSupportedAbis() // Files.buildFile() 用于构建一个 ScriptFile 对象 let dexPath = $files.buildFile((fileBuilder) => { // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder.setRelativePath("plugin", "dex/plugindex.dex") }) // Files.buildFile() 用于构建一个 ScriptFile 对象 let soPath = $files.buildFile((fileBuilder) => { // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder.setRelativePath("plugin", "so/" + abis[0] + "/") }) // Plugins.loadDex() 用于将dex作为插件加载 $plugins.loadDex(dexPath, soPath, 0) $console.log("loadDex end") // ---------------加载dex插件结束----------------------
local lib = require('com.example.script.lib') -- ---------------加载dex插件开始---------------------- _console:log("loadDex start") -- 获取设备所有支持的ABI local abis = lib.getSupportedAbis() -- Files.buildFile() 用于构建一个 ScriptFile 对象 local dexPath = _files:buildFile(function(fileBuilder) -- FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder:setRelativePath("plugin", "dex/plugindex.dex") end) -- Files.buildFile() 用于构建一个 ScriptFile 对象 local soPath = _files:buildFile(function(fileBuilder) -- FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder:setRelativePath("plugin", "so/" .. abis:get(0) .. "/") end) -- Plugins.loadDex() 用于将dex作为插件加载 _plugins:loadDex(dexPath, soPath, 0) _console:log("loadDex end") -- ---------------加载dex插件结束----------------------
<?php namespace com\example\script; require_once 'com/example/script/AbiUtils.php'; // //////////////-加载dex插件开始////////////////////// $console->log("loadDex start"); // 获取设备所有支持的ABI $abis = AbiUtils::getSupportedAbis(); // Files.buildFile() 用于构建一个 ScriptFile 对象 $dexPath = $files->buildFile(function ($fileBuilder) { // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 $fileBuilder->setRelativePath("plugin", "dex/plugindex.dex"); }); // Files.buildFile() 用于构建一个 ScriptFile 对象 $soPath = $files->buildFile(function ($fileBuilder) use ($abis, $objectWrappers) { // FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 $fileBuilder->setRelativePath("plugin", "so/" . $objectWrappers->wrap($abis)->elementAt(0) . "/"); }); // Plugins.loadDex() 用于将dex作为插件加载 $plugins->loadDex($dexPath, $soPath, 0); $console->log("loadDex end"); // //////////////-加载dex插件结束//////////////////////
from com.example.script import lib # ---------------加载dex插件开始---------------------- _console.log("loadDex start") # 获取设备所有支持的ABI abis = lib.getSupportedAbis(_java) def fn1(fileBuilder): # FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder.setRelativePath("plugin", "dex/plugindex.dex") def fn2(fileBuilder): # FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder.setRelativePath("plugin", "so/" + abis[0] + "/") # Files.buildFile() 用于构建一个 ScriptFile 对象 dexPath = _files.buildFile(fn1) # Files.buildFile() 用于构建一个 ScriptFile 对象 soPath = _files.buildFile(fn2) # Plugins.loadDex() 用于将dex作为插件加载 _plugins.loadDex(dexPath, soPath, 0) _console.log("loadDex end") # ---------------加载dex插件结束----------------------
require 'com/example/script/lib' # ---------------加载dex插件开始---------------------- $console.log("loadDex start") # 获取设备所有支持的ABI abis = Lib.getSupportedAbis() # Files.buildFile() 用于构建一个 ScriptFile 对象 dexPath = $files.buildFile { |fileBuilder| # FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder.setRelativePath("plugin", "dex/plugindex.dex") } # Files.buildFile() 用于构建一个 ScriptFile 对象 soPath = $files.buildFile { |fileBuilder| # FileBuilder.setRelativePath() 用于配置相对于项目根目录的路径 fileBuilder.setRelativePath("plugin", "so/" + abis[0] + "/") } # Plugins.loadDex() 用于将dex作为插件加载 $plugins.loadDex(dexPath, soPath, 0) $console.log("loadDex end") # ---------------加载dex插件结束----------------------
Last modified: 29 April 2025