CORDOVA 11 android构建失败:未解析的引用:防火墙示例ID

unftdfkk  于 2023-01-11  发布在  Android
关注(0)|答案(1)|浏览(175)

我正在尝试将我的应用从cordova移植到android。cordova,Gradle和cordova-android已经过时了,所以我更新了它们。现在的版本是:

  • 节点16.13.2
  • 国家预防机制8.1.2
  • cordova 11.0.0
  • cordova -机器人11.0.0
  • 等级7.6
  • JDK 11.0.16版本
  • 安卓API 32
  • Android SDK构建工具32.0.0

命令:cordova build --debug android --buildConfig
控制台上的错误:

cordova-plugin-androidx-adapter: Processed 61 source files in 2342ms
[cordova-plugin-push::before-compile] skipping before_compile hookscript.
Checking Java JDK and Android SDK versions
ANDROID_HOME=C:\Users\bryan\AppData\Local\Android\Sdk\ (recommended setting)
ANDROID_SDK_ROOT=C:\Users\bryan\AppData\Local\Android\Sdk\ (DEPRECATED)
Using Android SDK: C:\Users\bryan\AppData\Local\Android\Sdk\
Reading build config file: C:\Users\bryan\Documents\TCHE\bitBucket\backend\build.json
Reading the keystore from: C:\Users\bryan\Documents\TCHE\bitBucket\backend\tchedelivery.keystore
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
Adding classpath: com.google.gms:google-services:4.3.8

> Task :app:compileDebugKotlin
w: Runtime JAR files in the classpath should have the same version. These files were found in the classpath:
    C:/Users/bryan/.gradle/caches/transforms-3/37c16254af6de93c45d2587b8dfcd992/transformed/jetified-kotlin-stdlib-jdk7-1.5.20.jar (version 1.5)
    C:/Users/bryan/.gradle/caches/transforms-3/efb587c616850f9dc0cda8853a96db77/transformed/jetified-kotlin-stdlib-1.6.21.jar (version 1.6)
    C:/Users/bryan/.gradle/caches/transforms-3/b6f68fc904e7a7217e6038f3031dcf3a/transformed/jetified-kotlin-stdlib-common-1.6.21.jar (version 1.6)
w: Some runtime JAR files in the classpath have an incompatible version. Consider removing them from the classpath
e: C:\Users\bryan\Documents\TCHE\bitBucket\backend\platforms\android\app\src\main\java\com\adobe\phonegap\push\PushInstanceIDListenerService.kt: (5, 32): Unresolved reference: FireBaseInstanceId
e: C:\Users\bryan\Documents\TCHE\bitBucket\backend\platforms\android\app\src\main\java\com\adobe\phonegap\push\PushInstanceIDListenerService.kt: (25, 5): Unresolved reference: FireBaseInstanceId
e: C:\Users\bryan\Documents\TCHE\bitBucket\backend\platforms\android\app\src\main\java\com\adobe\phonegap\push\PushPlugin.kt: (19, 32): Unresolved reference: FireBaseInstanceId
e: C:\Users\bryan\Documents\TCHE\bitBucket\backend\platforms\android\app\src\main\java\com\adobe\phonegap\push\PushPlugin.kt: (465, 19): Unresolved reference: FireBaseInstanceId
e: C:\Users\bryan\Documents\TCHE\bitBucket\backend\platforms\android\app\src\main\java\com\adobe\phonegap\push\PushPlugin.kt: (472, 21): Unresolved reference: FireBaseInstanceId
e: C:\Users\bryan\Documents\TCHE\bitBucket\backend\platforms\android\app\src\main\java\com\adobe\phonegap\push\PushPlugin.kt: (615, 11): Unresolved reference: FireBaseInstanceId

> Task :app:compileDebugKotlin FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
> Run with --stacktrace option to get the stack trace.

这只发生在我添加"onesignal-cordova-plugin"。插件版本是3.3.0(最新)。
我已经尝试更新所有的构建工具(cordova是9,我更新到11,相同的cordova-android,gradle是6.6.1,我更新到7.6,...)
我尝试过清理Gradle缓存("C:/Users/bryan/. gradle/caches/transforms-3/")

ogsagwnx

ogsagwnx1#

首先也是最重要的,不要一次升级多个版本。尤其是cordova-android。一个版本一个版本的升级,阅读相关的更新文档。它们都是主要版本,因此会有重大的变化。如果你必须一次解决几个错误,你会让自己更难(在我看来,cordova-android-10现在也很好)。target-sdk升级也包括一些突破性的变化。这里是cordova-android 10的更新文档。它们适用于所有版本:https://cordova.apache.org/announcements/2021/07/20/cordova-android-10.0.0.html
至于你的具体错误,你使用的是哪个版本的phone-plugin-push(这似乎是抛出你的错误)?是这一个:https://www.npmjs.com/package/phonegap-plugin-push?因为它有一个很大的弃用警告,我们切换到这个:https://www.npmjs.com/package/@havesource/cordova-plugin-push(不确定这是原因还是其他问题)。但您仍然需要修补它以在需要的地方添加FLAG_MUTABLE。(您可以使用patch-package完成此操作)插件库中的此问题也可能会对此错误有所帮助:https://github.com/phonegap/phonegap-plugin-push/issues/2768,根本原因似乎是该instanceID的实现已更改。
让我知道这是否解决了您的问题,或者是否有任何剩余的错误。我自己已经做了那些更新,我知道它们可能是一个痛苦,可能需要一些更多的挂钩和补丁。

相关问题