Importing ZXing - missing core/build.xml
Asked Answered
L

5

7

I'm trying to import Google's ZXing.

I downloaded the latest release from https://code.google.com/p/zxing/downloads/detail?name=ZXing-2.2.zip&can=2&q=

From the cmd prompt I navigated to the root directory of the downloaded zxing and tried to execute

ant -f core\build.xml

PROBLEM :

Buildfile : build.xml does not exist!

Build failed

My zxing-2.2/core file contains :

src

test

pom.xml

Questions: How to build a file that is missing? Is it a problem from the zxing-2.2.jar I downloaded?

Llovera answered 31/5, 2013 at 12:27 Comment(0)
L
10

This problem happened to me too, I solved it by creating the build.xml file inside core folder

change name="whatever you want" in the second line, here it's "project"

code of build.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project name="project" default="jar" basedir=".">

    <target name="compile" description="Compile source">
        <mkdir dir="bin" />
        <javac srcdir="src" includes="**" destdir="bin"/>
        <copy todir="bin">
            <fileset dir="src" />
        </copy>
    </target>

    <target name="jar" description="Package into JAR" depends="compile">
        <jar destfile="project.jar" basedir="bin" compress="true" />
    </target>
</project>

Run the build command again and see if it works.

Lecithinase answered 5/6, 2013 at 2:10 Comment(2)
I created build.xml downloads\zxing-2.2\core>ant -f core/build.xml and when I run the build again it says 'ant' is not recognized as an internal or external commandTailspin
thanks a lot . it worked fine . instead of src directory . I modified to src\main to avoid test folderTolliver
S
3

Please do consider that you can always use the pom.xml to achieve the same. This is the method prescribed in the official zxing documentation https://code.google.com/p/zxing/wiki/GettingStarted The commands I have used are as follows: cd core mvn -DskipTests -Dgpg.skip=true install

That's it, you are done. Obviously, maven is to be installed before using the code

Snubnosed answered 31/8, 2013 at 7:4 Comment(0)
B
2

I tried the accepted answer, but unfortunately it not worked. Actually the jar was built successfully, but it was not built into the apk when Eclipse built the project. This was when i referenced ZXing as a library project. I managed to write an ant script which works, so i share it here:

<?xml version="1.0" encoding="utf-8" ?>
<project name="core" basedir="." default="dist" >

    <property name="dist.dir" value="dist" />
    <property name="src.dir" value="src" />
    <property name="build.dir" value="bin" />

    <target name="dist" depends="clean, package" />
    <target name="clean" >
        <delete dir="${build.dir}" />
    </target>
    <target name="init" >
        <mkdir dir="${build.dir}" />
    </target>
    <target name="compile" >
        <javac debug="off" destdir="${build.dir}" source="1.6" srcdir="${src.dir}" target="1.6" />
    </target>
    <target name="package" depends="init, compile" >
        <jar basedir="${build.dir}" destfile="${dist.dir}/core.jar" />
    </target>

</project>
Bailment answered 8/8, 2013 at 21:44 Comment(0)
D
2

If you just need the core.jar from zxing, you can skip that process and get the pre-built JARs from the GettingStarted wiki page

Core.jar is the library solution to integrate zxing in your app

(the other option is via Intent but BarcodeScanner.apk is needed)

For zxing2.2, you can obtain the core.jar from the zxing Maven repository here

Dutyfree answered 26/9, 2013 at 10:44 Comment(0)
D
0

Zxing 2.2 and above don't include core/build.xml

If the original file is necessary I recommend using Zxing 2.1, which can be found here: https://code.google.com/p/zxing/downloads/detail?name=ZXing-2.2.zip&can=2&q=

Dinge answered 23/2, 2014 at 18:25 Comment(1)
it's redirect to git latest code. I didn't find anything for this.Solifluction

© 2022 - 2024 — McMap. All rights reserved.