【问题标题】:TNS-Core-Modules dependency conflict with Nativescript 8TNS-Core-Modules 依赖与 Nativescript 8 冲突
【发布时间】:2022-02-23 08:15:16
【问题描述】:

我继承了一些在 iOS 上运行良好但在 Android 上失败的 Nativescript 代码。

我的环境是: 安卓 SDK 11 JDK 14 节点 16

我的 package.json 依赖项是:

"dependencies": {
"@nativescript/core": "~8.1.1",
"@nativescript/firebase": "^11.1.3",
"@nativescript/theme": "~3.0.1",
"nativescript-vue": "~2.9.0",
"tns-core-modules": "^6.5.27"
},
"devDependencies": {
"@nativescript/android": "8.1.1",
"@nativescript/ios": "8.1.0",
"@nativescript/webpack": "~5.0.0",
"nativescript-vue-template-compiler": "~2.9.0",
"sass": "^1.32.8"
}

问题似乎是由推送通知的实现引起的,其中要求获取设备的 UUID。

在代码的初始版本中,他们使用了一个名为“nativescript-uuid”的库。使用该库并以 iOS 为目标似乎工作正常。但是,在针对 Android 时,我会收到一个错误,它找不到类似“找不到模块 tns-core-modules/platform ....”的内容。我查看了 tns-core-modules,发现它不在我的 node_modules 文件夹中,我使用 tns 插件添加“tns-core-modules”将其添加为依赖项。这消除了该特定错误,但引入了一个关于冲突类名的新错误:

Warning: there already is an extend called com.tns.FragmentClass.
Warning: The static binding generator will generate extend from:vendor.js implementation
java.io.IOException: File already exists. This may lead to undesired behavior.
Please change the name of one of the extended classes.
File:C:<APP DIRECTORY>\platforms\android\app\src\main\java\com\tns\FragmentClass.java 
Class: com.tns.FragmentClass
at org.nativescript.staticbindinggenerator.Generator.writeBindings(Generator.java:112)
at org.nativescript.staticbindinggenerator.Main.main(Main.java:55)

在我进入谷歌搜索的兔子洞之前,我想知道是否有人知道为什么这首先会失败,以及是否有任何关于如何解决问题的建议。

【问题讨论】:

    标签: nativescript nativescript-vue


    【解决方案1】:

    该插件已经有一段时间没有更新了。有一个 fork,@kefah/nativescript-uuid/,宣传自己与 NativeScript 8 兼容。

    【讨论】:

      猜你喜欢
      • 2015-06-22
      • 2018-10-24
      • 1970-01-01
      • 2016-11-05
      • 2017-10-15
      • 2019-08-08
      • 2015-04-12
      • 1970-01-01
      • 2021-11-05
      相关资源
      最近更新 更多