如何克服缺失的依赖构建Zxing安卓应用程序



我正在尝试使用此处的说明构建Zxing android应用程序(而不是库(。我能够构建罐子,但无法构建应用程序本身。当我运行mvn包android:apk时,我得到以下错误:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for com.google.android:android:jar is missing. @ line 34, column 17
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project com.google.zxing:android:4.7.9 (c:GitNucleuszxingandroidpom.xml) has 1 error
[ERROR]     'dependencies.dependency.version' for com.google.android:android:jar is missing. @ line 34, column 17
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

如有任何帮助,我们将不胜感激。更好的是一些关于使用Android Studio构建应用程序的说明。

您可以从下面的行中看到错误所在

[ERROR]com.google.android:android:jar的dependencies.dependency.version丢失。@第34行,第17列

您需要向依赖项添加一个有效的<version>标记。检查Maven存储库中的工件,我们可以看到最新版本是4.1.14

确保包含依赖项的POM看起来像

<platform.version>4.1.1.4<platform.version>

这里也提到了这个答案,所以我想你也有同样的问题。

检查是否遗漏了依赖关系的<dependencyManagement>标记。

你也可以检查这个答案以更好地理解。

最新更新