当前位置:网站首页>uniapp 插件开发
uniapp 插件开发
2022-06-11 08:13:00 【明耀】
详细查看
https://nativesupport.dcloud.net.cn/NativePlugin/course/android
1、新建一个library
2、配置刚创建的Module的build.gradle信息。
repositories {
flatDir {
dirs 'libs'
}
}
dependencies {
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
compileOnly fileTree(dir: '../app/libs', include: ['uniapp-v8-release.aar'])
compileOnly 'androidx.recyclerview:recyclerview:1.0.0'
compileOnly 'androidx.legacy:legacy-support-v4:1.0.0'
compileOnly 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.alibaba:fastjson:1.1.46.android'
implementation 'com.facebook.fresco:fresco:1.13.0'
}
3、创建TestModule类
package com.mingshine.utils;
import com.alibaba.fastjson.JSONObject;
import io.dcloud.feature.uniapp.annotation.UniJSMethod;
import io.dcloud.feature.uniapp.common.UniModule;
public class CommonUtils extends UniModule {
//run JS thread
@UniJSMethod(uiThread = false)
public JSONObject testSyncFunc() {
JSONObject data = new JSONObject();
data.put("code", "success");
return data;
}
}
4、生成uni-app插件
|-- DCloud-RichAlert —>插件id命名的文件夹
|-- android —>安卓插件目录


package.json
{
"name": "utils",
"id": "ComMingshineUtils",
"version": "1.0.0",
"description": "工具",
"_dp_type":"nativeplugin",
"_dp_nativeplugin":{
"android": {
"plugins": [
{
"type": "module",
"name": "ComMingshineUtils-CommonUtils",
"class": "com.mingshine.utils.CommonUtils"
}
],
"integrateType": "aar"
}
}
}
边栏推荐
- Typescript class and interface, class and generic, interface merging
- Layout of code setting constraintlayout_ constraintDimensionRatio
- 嵌入式软件面试问题总结
- Record a murder case caused by ignoring the @suppresslint ("newapi") prompt
- TypeScript-声明合并
- Summary of knowledge points of customized ViewGroup - continuously updated
- 代码设置ConstraintLayout的layout_constraintDimensionRatio
- Switch statement
- 学习《缠解论语》
- Servlet、ServletConfig、ServletContext
猜你喜欢

Js学习基础document.write在页面中写一行文字

嵌入式软件面试问题总结

Bubble sorting with C language

SylixOS SD设备驱动开发

2022.6.6 特长生模拟

Tutoriel de démarrage bladed (vidéo)

Alchemy experience (model training of deep learning) the necessity of timely adjusting training parameters for some situations (the adjustment of learning rate LR is the primary) summarizes some metho

Xshell7 and xftp7 to continue using this program, you must apply the latest updates or use a new version

Detailed explanation of character function and string function (including simulation implementation)
![Socket [5] - struct linker usage](/img/e5/bce5d89c61a3a4f89171734ca6ff8e.png)
Socket [5] - struct linker usage
随机推荐
torch. unbind()
用 Keras/TensorFlow 2.9 创建深度学习模型的方法总结
Development of sylixos SD device driver
Collation of basic knowledge of intermediate development of Andrews (for interview)
C language to achieve a simple game - minesweeping
TypeScripy-类的基本使用
2022.6.6 特长生模拟
AttributeError: module ‘tensorflow. compat. v2.__ internal__‘ has no attribute ‘register_ clear_ session_
关于网络知识的50个问答题,你能答对几个?
如何做好空状态设计?来看这份全面总结
[transfer] two-way merging and sorting of C language
In an activity, view postdelay will cause memory leakage, but will not affect the life cycle execution of the activity.
TypeScript-接口和类型别名异同
JS learning basics document Write write a line of text in the page
How CSDN reports plagiarized articles
【 史上最全的ENSP【安装图解】!】
使用POSTMAN 测试firebase
Niuke JS wrong question knowledge point record
空间几何
TypeScript-头文件使用细节