当前位置:网站首页>Uniapp plug-in development
Uniapp plug-in development
2022-06-11 08:13:00 【bright and dazzling】
Detailed view
https://nativesupport.dcloud.net.cn/NativePlugin/course/android
1、 Create a new one library
2、 Configure just created Module Of build.gradle Information .
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、 establish TestModule class
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、 Generate uni-app plug-in unit 
|-- DCloud-RichAlert —> plug-in unit id Named folder
|-- android —> Android plug in directory 


package.json
{
"name": "utils",
"id": "ComMingshineUtils",
"version": "1.0.0",
"description": " Tools ",
"_dp_type":"nativeplugin",
"_dp_nativeplugin":{
"android": {
"plugins": [
{
"type": "module",
"name": "ComMingshineUtils-CommonUtils",
"class": "com.mingshine.utils.CommonUtils"
}
],
"integrateType": "aar"
}
}
}
边栏推荐
- How CSDN reports plagiarized articles
- TypeScript-头文件使用细节
- Solution to the occurrence interval (space) of latex manual numbering documents
- JS basic learning script
- Thoroughly remember the difference between ImageView background and SRC
- Batch splice string
- 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
- Solve ('You must install pydot (`pip install pydot`) and install graphviz (see...) '‘ for plot_ model..
- How to do well in empty state design? Look at this comprehensive summary
- TypeScript-可辨识联合
猜你喜欢

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

Return in foreach and break in for

如何开始参与开源社区

Getting started with bladed tutorial (video)

node报错整理

Tutoriel de démarrage bladed (vidéo)

Selenium click the floating menu and realize the functions of right mouse button

Summary of embedded software interview questions

Development of sylixos SD device driver

【案例解读】医疗单据OCR识别助力健康险智能理赔
随机推荐
代码设置ConstraintLayout的layout_constraintDimensionRatio
Summary of evaluation index knowledge points in target detection: summary of IOU cross overlap unit and map/ap/tp/fp/np
Solve notimplementederror: layer XX has arguments in`__ init__` and therefore must override `get_ config`
Typescript type alias
关于网络知识的50个问答题,你能答对几个?
Session and session management technology
TypeScript-可辨识联合
Image processing operation record
Modulenotfounderror: no module named 'tensorboard in pytorch‘
Several ways to avoid concurrent modification exceptions of lists
Socket [5] - struct linker usage
Figure seamless database integration tushare interface
避免list的并发修改异常的几种方式
Return in foreach and break in for
torch. roll
【 史上最全的ENSP【安装图解】!】
Typescript unknown type
Layout of code setting constraintlayout_ constraintDimensionRatio
(resolved) typeerror: meshgrid() got an unexpected keyword argument 'indexing‘
JSP development model