如何克服构建 Zxing android 应用程序时缺少的依赖项?

How to get past missing dependencies building Zxing android app?

我正在尝试使用说明 here 构建 Zxing android 应用程序(不是库)。我能够构建罐子但无法构建应用程序本身。当我 运行 mvn package 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:\Git\Nucleus\zxing\android\pom.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 构建应用程序的说明。

检查您是否没有错过 <dependencyManagement> 依赖项标记。

您也可以查看 this 答案以便更好地理解。

你可以从下面这行看出错误在哪里

[ERROR] 'dependencies.dependency.version' for com.google.android:android:jar is missing. @ line 34, column 17

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

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

<platform.version>4.1.1.4</platform.version>

这也被作为答案提到 here 所以我想你遇到了同样的问题。