当前位置:网站首页>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"
}
}
}
边栏推荐
- 860. lemonade change
- How to start participating in the open source community
- 使用特殊字符拼接字符串“+“
- Return in foreach and break in for
- Js基础学习Script
- DAMENG 数据库登陆
- Login and parameterization of interface test
- Use special characters to splice strings "+“
- Scrape captures 51job Recruitment Information (static page)
- Note: JDBC
猜你喜欢

Batch splice string

Tidb cloud launched Google cloud marketplace, empowering global developers with a new stack of real-time HTAP databases

Tutoriel de démarrage bladed (vidéo)

Solve valueerror: no model found in config file

Using Tkinter to realize guessing numbers game

How to start participating in the open source community

Use of Excel to XML tool of TestLink

Method summary of creating deep learning model with keras/tensorflow 2.9

Process control: process waiting (recycling child processes)

torch. nn. functional. pad
随机推荐
Niuke JS wrong question knowledge point record
Semiconductor memory classification
134. gas station
El expressions and JSTL
TypeScript-类和接口、类和泛型、接口合并现象
A detailed explanation of one of the causes of dead loop caused by array out of bounds in C language
2022.6.6 extra long growth simulation
【 史上最全的ENSP【安装图解】!】
Dameng user management
TypeScript-类型保护
Logical implication of functional dependence
Batch splice string
[transfer] two-way merging and sorting of C language
Deep understanding of add in argparse module_ Argument parameters (such as action)
Shell Programming Notes
SylixOS SD设备驱动开发
Typescript type alias
Closure and minimum dependency in database
DAMENG 数据库启停
Typescript interface and type alias similarities and differences