x***@126.com
x***@126.com
  • 发布:2025-08-25 21:31
  • 更新:2025-08-25 21:33
  • 阅读:700

uts引用原生jar包报错:"error: Unresolved reference: HtmlParser‌"

分类:uts

无法在本地编译,云自定义基座也失败,报错信息如下:

e: file://[PackagePath]/wgtRoot/UNI1A69081/.uniappx/android/src/index.kt:3:12 Unresolved reference: miku
e: file://[PackagePath]/wgtRoot/UNI1A69081/.uniappx/android/src/index.kt:75:17 Unresolved reference: HtmlParser

打包的jar文件是通过原生java+maven打包构建的,里面所有的依赖都存在jar包里面,并且在其他maven项目导入测试过,没有问题,package.json以及manifest.json都没有动过,皆为项目创建时的默认模板.

package.json

{  
    "id": "miku-test",  
    "displayName": "miku-test",  
    "version": "1.0.0",  
    "description": "miku-test",  
    "keywords": [  
        "miku-test"  
    ],  
    "repository": "",  
    "engines": {  
        "HBuilderX": "^3.6.8",  
        "uni-app": "^3.1.0",  
        "uni-app-x": "^3.1.0"  
    },  
    "dcloudext": {  
        "type": "uts",  
        "sale": {  
            "regular": {  
                "price": "0.00"  
            },  
            "sourcecode": {  
                "price": "0.00"  
            }  
        },  
        "contact": {  
            "qq": ""  
        },  
        "declaration": {  
            "ads": "",  
            "data": "",  
            "permissions": ""  
        },  
        "npmurl": "",  
        "darkmode": "-",  
        "i18n": "-",  
        "widescreen": "-"  
    },  
    "uni_modules": {  
        "dependencies": [],  
        "encrypt": [],  
        "platforms": {  
            "cloud": {  
                "tcb": "-",  
                "aliyun": "-",  
                "alipay": "-"  
            },  
            "client": {  
                "uni-app": {  
                    "vue": {  
                        "vue2": "-",  
                        "vue3": "-"  
                    },  
                    "web": {  
                        "safari": "-",  
                        "chrome": "-"  
                    },  
                    "app": {  
                        "vue": "-",  
                        "nvue": "-",  
                        "android": "-",  
                        "ios": "-",  
                        "harmony": "-"  
                    },  
                    "mp": {  
                        "weixin": "-",  
                        "alipay": "-",  
                        "toutiao": "-",  
                        "baidu": "-",  
                        "kuaishou": "-",  
                        "jd": "-",  
                        "harmony": "-",  
                        "qq": "-",  
                        "lark": "-"  
                    },  
                    "quickapp": {  
                        "huawei": "-",  
                        "union": "-"  
                    }  
                },  
                "uni-app-x": {  
                    "web": {  
                        "safari": "-",  
                        "chrome": "-"  
                    },  
                    "app": {  
                        "android": "-",  
                        "ios": "-",  
                        "harmony": "-"  
                    },  
                    "mp": {  
                        "weixin": "-"  
                    }  
                }  
            }  
        }  
    }  
}

manifest.json

{  
    "name": "mikufans_lib_test",  
    "appid": "my uuid",  
    "description": "",  
    "versionName": "1.0.0",  
    "versionCode": "100",  
    "uni-app-x": {},  
    /* 快应用特有相关 */  
    "quickapp": {},  
    /* 小程序特有相关 */  
    "mp-weixin": {  
        "appid": "",  
        "setting": {  
            "urlCheck": false  
        },  
        "usingComponents": true  
    },  
    "mp-alipay": {  
        "usingComponents": true  
    },  
    "mp-baidu": {  
        "usingComponents": true  
    },  
    "mp-toutiao": {  
        "usingComponents": true  
    },  
    "uniStatistics": {  
        "enable": false  
    },  
    "vueVersion": "3",  
    "app": {  
        "distribute": {  
            "icons": {  
                "android": {  
                    "hdpi": "",  
                    "xhdpi": "",  
                    "xxhdpi": "",  
                    "xxxhdpi": ""  
                }  
            }  
        }  
    },  
    "app-android": {  
        "distribute": {  
            "modules": {},  
            "icons": {  
                "hdpi": "",  
                "xhdpi": "",  
                "xxhdpi": "",  
                "xxxhdpi": ""  
            },  
            "splashScreens": {  
                "default": {}  
            },  
            "abiFilters": [  
                "x86"  
            ]  
        }  
    },  
    "app-ios": {  
        "distribute": {  
            "modules": {},  
            "icons": {},  
            "splashScreens": {}  
        }  
    }  
}
2025-08-25 21:31 负责人:无 分享
已邀请:
x***@126.com

x***@126.com (作者) - hello!

附上java代码:

package com.miku;  

import com.alibaba.fastjson.JSON;  
import org.jsoup.Jsoup;  
import org.jsoup.nodes.Document;  

import java.util.ArrayList;  

public class HtmlParser {  
  public String getString(String key) {  
    return "you get a" + key;  
  }  

  public Object getJSON(String key) {  
    ArrayList<String> list = new ArrayList<>();  
    list.add("jack");  
    list.add("Lucy");  
    return JSON.toJSON(list);  
  }  
  public Document getParser(String s){  
    return Jsoup.parse(s);  
  }  
}

要回复问题请先登录注册