简体   繁体   中英

Ant build issue with my Android Project

I get the following error when building my project. I suspect Butterknife library to be a reason, as I have annotations enabled through it. Do we need any special configurations to include butterknife with Ant build? Kindly let me know if you have any suggestions.

[javac] error: Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider dagger.internal.codegen.ProvidesProcessor could not be instantiated: java.lang.NoClassDefFoundError: dagger/internal/Binding

I solved the problem: I had to include the Annotation processor with the javac compile options and point it to the butterknife jar file.

For this, create a "custom_rules.xml" file, and add the following target for javac:

<javac encoding="${java.encoding}"
                    source="${java.source}" target="${java.target}"
                    debug="true" extdirs="" includeantruntime="false"
                    destdir="${out.classes.absolute.dir}"
                    bootclasspathref="project.target.class.path"
                    verbose="${verbose}"
                    classpathref="project.javac.classpath"
                    fork="${need.javac.fork}">
                <src path="${source.absolute.dir}" />
                <src path="${gen.absolute.dir}" />
                <compilerarg line="${java.compilerargs}" />
        <compilerarg line="-processorpath ${processorpath}"/>
            </javac>

Make your processorpath point to butterknife.jar file. Hope, this helps some one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM