2***@qq.com
2***@qq.com
  • 发布:2023-11-28 16:53
  • 更新:2023-12-16 12:03
  • 阅读:845

uts插件可以通过云打包正常生效,但只要本地热更新uts代码就会报错,即便无更改时也会

分类:uts
uni_module [ns-miniServer] Error:   
16:24:23.549 FAILURE: Build failed with an exception.  
16:24:23.567 * What went wrong:  
16:24:23.568 Execution failed for task ':androidDependencies'.  
16:24:23.609 > Failed to notify dependency resolution listener.  
16:24:23.623    > Failed to notify dependency resolution listener.  
16:24:23.624       > 'void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)'  
16:24:23.638    > 'void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)'  
16:24:23.639 * Try:  
16:24:23.649 > Run with --stacktrace option to get the stack trace.  
16:24:23.649 > Run with --info or --debug option to get more log output.  
16:24:23.659 > Run with --scan to get full insights.  
16:24:23.669 > Get more help at https://help.gradle.org.  
16:24:23.670 BUILD FAILED in 14s  
16:24:23.679 Error:   
16:24:23.680 FAILURE: Build failed with an exception.  
16:24:23.688 * What went wrong:  
16:24:23.689 Execution failed for task ':androidDependencies'.  
16:24:23.697 > Failed to notify dependency resolution listener.  
16:24:23.697    > Failed to notify dependency resolution listener.  
16:24:23.707       > 'void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)'  
16:24:23.707    > 'void org.gradle.api.artifacts.DependencySubstitutions$Substitution.with(org.gradle.api.artifacts.component.ComponentSelector)'  
16:24:23.714 * Try:  
16:24:23.714 > Run with --stacktrace option to get the stack trace.  
16:24:23.724 > Run with --info or --debug option to get more log output.  
16:24:23.725 > Run with --scan to get full insights.  
16:24:23.735 > Get more help at https://help.gradle.org.  
16:24:23.736 BUILD FAILED in 14s  
16:24:23.746     at E:\HBuilderX\plugins\uts-development-android\out\external.js:20:23228  
16:24:23.748     at Generator.next (<anonymous>)  
16:24:23.760     at E:\HBuilderX\plugins\uts-development-android\out\external.js:20:19692  
16:24:23.762     at new Promise (<anonymous>)  
16:24:23.773     at E:\HBuilderX\plugins\uts-development-android\out\external.js:20:19437  
16:24:23.774     at ChildProcess.<anonymous> (E:\HBuilderX\plugins\uts-development-android\out\external.js:20:23049)  
16:24:23.784     at ChildProcess.emit (node:events:513:28)  
16:24:23.786     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)  
16:24:29.561 ‌error: Class 'OtherCallback' is not abstract and does not implement abstract member public abstract fun onEnd(p0: String!): Unit defined in com.example.miniserver.JsCallback‌  
16:24:29.563 at uni_modules/ns-miniServer/utssdk/app-android/index.uts:16:2  
16:24:29.572 14 |   private server : MiniServer;  
16:24:29.573 15 |   constructor(options : opt) {  
16:24:29.584 16 |    class OtherCallback implements JsCallback {  
16:24:29.585    |    ^  
16:24:29.593 17 |     public override  onEnd(result : string, time : string) : void {  
16:24:29.594 18 |      options.onSaved(result, time)  
16:24:29.600 ‌error: 'onEnd' overrides nothing‌  
16:24:29.600 at uni_modules/ns-miniServer/utssdk/app-android/index.uts:17:3  
16:24:29.608 15 |   constructor(options : opt) {  
16:24:29.609 16 |    class OtherCallback implements JsCallback {  
16:24:29.615 17 |     public override  onEnd(result : string, time : string) : void {  
16:24:29.623    |     ^  
16:24:29.623 18 |      options.onSaved(result, time)  
16:24:29.629 19 |     }  
16:24:29.630 ‌error: Cannot access class 'com.koushikdutta.async.AsyncServerSocket'. Check your module classpath for missing or conflicting dependencies‌  
16:24:29.638 at uni_modules/ns-miniServer/utssdk/app-android/index.uts:25:14  
16:24:29.639 23 |    this.server.get("/", UTSAndroid.getResourcePath("uni_modules/ns-miniServer/static/index.html"))  
16:24:29.645 24 |    this.server.post("/postBook", "options.msg", app.getCacheDir().getAbsolutePath() + File.separator, new OtherCallback())  
16:24:29.646 25 |    this.server.listen(4567)  
16:24:29.653    |                ^  
16:24:29.655 26 |   }  
16:24:29.661 27 |  

以上有三个错误,我已经做过处理,可以过云打包并生效,但本地编译一直不通过
错误一:
‌error: Class 'OtherCallback' is not abstract and does not implement abstract member public abstract fun onEnd(p0: String!): Unit defined in com.example.miniserver.JsCallback‌
这是老接口的成员,我已经更新成新接口了,云打包无问题,本地打包报错

错误二:‌error: 'onEnd' overrides nothing‌
加不加修饰符本地都报错,加了云打包不报错

错误三:error: Cannot access class 'com.koushikdutta.async.AsyncServerSocket'. Check your module classpath for missing or conflicting dependencies‌
这是我写的aar里的依赖,已经在uts的config.json声明过了
···json
{
"dependencies": [
"com.koushikdutta.async:androidasync:3.1.0"
]
}
···
这样声明后云打包通过并生效,本地热更新uts报错

2023-11-28 16:53 负责人:无 分享
已邀请:

最佳回复

DCloud

DCloud

HBuilderX 3.99.2023121601-alpha 已修复。

2***@qq.com

2***@qq.com (作者)

错误三:error: Cannot access class 'com.koushikdutta.async.AsyncServerSocket'. Check your module classpath for missing or conflicting dependencies‌
已解决
https://uniapp.dcloud.net.cn/tutorial/run/uts-development-android.html,注意gradle版本要和红圈里的版本一致

2***@qq.com

2***@qq.com (作者)

错误一和错误二是同一个错误,接口已经更新了,但是还在校验旧接口。有时候uts代码已经删了,但被删除的逻辑依旧被执行了。这是缓存的问题?

  • 2***@qq.com (作者)

    已解决,方法是删除项目根目录下unpackage目录里的内容

    2023-11-29 18:37

  • DCloud_UNI_FXY

    你说的错误1,错误2,接口已经更新,这里的接口是uts写的,还是三方依赖?

    2023-12-04 16:14

  • 2***@qq.com (作者)

    回复 DCloud_UNI_FXY: 三方依赖,java写的接口,接口更改后,再次打包自定义基座,运行app,依然是旧接口。

    2023-12-04 18:21

要回复问题请先登录注册