打包流程接近正确,目前跳转传值没问题,只是有好多业务需要在application里初始化,而试了好多办法都不行,如下:
application、 UniAppHookProxy 的声明
注意 以下代码为出现问题的代码 ,并非解决问题之后的!
public class PluginApp extends Application {
@Override
public void onCreate() {
super.onCreate();
DebugLogUtil.getInstance().Debug("PluginApp ");
}
}
public class PluginApp_AppProxy implements UniAppHookProxy {
@Override
public void onCreate(Application application) {
DebugLogUtil.getInstance().Debug("UniApp - onCreate ");
}
@Override
public void onSubProcessCreate(Application application) {
DebugLogUtil.getInstance().Debug("PluginApp - onSubProcessCreate ");
}
}
uniapp 工程中的插件配置
{
"name": "hi ,uniplugin_module",
"id": "uniplugin_module",
"version": "1.0.2",
"description": "仅测试用",
"_dp_type": "nativeplugin",
"_dp_nativeplugin": {
"android": {
"hooksClass": "io.dcloud.uniplugin.PluginApp_AppProxy",
"plugins": [{
"type": "module",
"name": "uniplugin_module",
"class": "io.dcloud.uniplugin.TestModule"
}],
"integrateType": "aar",
"compileOptions": {
"sourceCompatibility": "1.8",
"targetCompatibility": "1.8"
},
"abis": [
"armeabi-v7a", "arm64-v8a"
],
"minSdkVersion": "21",
"useAndroidX": true
}
}
}
解决了,仔细对比文档和demo ,别像我一样掺杂自己的想法就行