google-service/firebase vs gradle 或 java 上的 Cordova 构建错误

Posted

技术标签:

【中文标题】google-service/firebase vs gradle 或 java 上的 Cordova 构建错误【英文标题】:Cordova build error on google-service/firebase vs gradle or java 【发布时间】:2021-12-08 04:58:01 【问题描述】:

我正在使用 Cordova,当我运行 cordova build android 时,它会抛出一个错误。就像几个月前一样,构建 APK 没有问题。我认为 Java 确实会自动更新,导致出现问题?

我想这与com.google.gms:google-service 和 gradle 有关?我不知道。

这是完整的终端输出:

% cordova build android
[Gradle Properties] Detected Gradle property "android.useAndroidX" with the value of "true", Cordova's recommended value is "false"
[Gradle Properties] Detected Gradle property "android.enableJetifier" with the value of "true", Cordova's recommended value is "false"
cordova-plugin-firebasex: Preparing Firebase on Android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: /Users/<user>/Library/Android/sdk
Subproject Path: CordovaLib
Subproject Path: app

> Configure project :app
Adding classpath: com.google.gms:google-services:4.2.0
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Task :app:processDebugGoogleServices
Parsing json file: /Users/<user>/Sites/cordova/<projectname>/platforms/android/app/google-services.json

> Task :CordovaLib:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':CordovaLib:compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1s
21 actionable tasks: 5 executed, 16 up-to-date
Command failed with exit code 1: /Users/<user>/Sites/cordova/<project>/platforms/android/gradlew cdvBuildDebug -b /Users/<user>/Sites/cordova/<project>/platforms/android/build.gradle

版本

javac -version
javac 1.8.0_292
------------------------------------------------------------
Gradle 6.9.1
------------------------------------------------------------

Build time:   2021-08-20 11:15:18 UTC
Revision:     f0ddb54aaae0e44f0a7209c3c0274d506ea742a0

Kotlin:       1.4.20
Groovy:       2.5.12
Ant:          Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM:          11.0.12 (Homebrew 11.0.12+0)
OS:           Mac OS X 11.3.1 x86_64

提前感谢您的任何建议!

【问题讨论】:

【参考方案1】:

好的.. 所以我解决了这部分,但想把这篇文章留在这里给其他可能遇到同样问题的人。

Gradle

brew uninstall gradle@6(因为我手动安装了这个版本)

brew install gradle(目前正在安装7.1.1版本)

科尔多瓦

cordova platform remove android(我在 9)

cordova platform add android@10.1.0

【讨论】:

以上是关于google-service/firebase vs gradle 或 java 上的 Cordova 构建错误的主要内容,如果未能解决你的问题,请参考以下文章

selenium chromedriver geckodriver iedriverserver下载

golang:%v,%+v,%#v的区别

v-show、v-if、v-bind

Vue.js常用指令汇总(v-if//v-show//v-else//v-for//v-bind//v-on等)

根据每个元素的i属性,由小到大排列如下数组ar=[{i:5,v:1},{i:5,v:4},{i:2,v:1},{i:1,v:3},{i:3,v:2},{i:6,v:1},{i:4,v:1}];

证明 U and V={0}时 dim(U+V)=dim(U)+dim(V)