Search code examples
zxing

How to get past missing dependencies building Zxing android app?


I am trying to build the Zxing android app (not the libraries) using the instructions here. I was able to build the jars but cannot build the app itself. When I run mvn package android:apk I get the following error:

[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

Any help would be greatly appreciated. Even better would be some instructions on building the app with Android Studio.


Solution

  • You can see where the error is from the following line

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

    You will need to add a valid <version> tag to the dependency. Checking the Maven repository for the artifact, we can see the latest version is 4.1.14.

    Ensure your POM containing the dependency looks like

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

    This was also mentioned as an answer here so I imagine you're having the same problem.