Hi,
I have a build.xml file which performs following task.
1. Clean the project. and
2. Build the project.
Using command prompt I am trying to clean and build the project.
I am successfully able to clean the project but while creating the
build file I am getting an error.
The "Bin" folder is getting created but no .apk file.
I have used following code:
------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
Any modifications will be overwritten.
To include a user specific buildfile here, simply create
one in the same
directory with the processing instruction <?
eclipse.ant.import?>
as the first entry and export the buildfile again. -->
<project basedir="." default="build" name="CalculatorApplication">
<property environment="env"/>
<property name="CalculatorApplicationTest.location" value="../
CalculatorApplicationTest"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="Android 1.5.libraryclasspath">
<pathelement location="D:/Downloads/Android/android-sdk-
windows/platforms/android-3/android.jar"/>
</path>
<path id="JUnit 4.libraryclasspath">
<pathelement location="D:/Android/eclipse-java-galileo-win32/
plugins/org.junit4_4.5.0.v20090824/junit.jar"/>
<pathelement location="D:/Android/eclipse-java-galileo-win32/
plugins/org.hamcrest.core_1.1.0.v20090501071000.jar"/>
</path>
<path id="CalculatorApplication.classpath">
<pathelement location="bin"/>
<path refid="Android 1.5.libraryclasspath"/>
<path refid="JUnit 4.libraryclasspath"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
<copy includeemptydirs="false" todir="bin">
<fileset dir="gen">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin"
source="${source}" target="${target}" includeantruntime="false">
<src path="src"/>
<classpath refid="CalculatorApplication.classpath"/>
</javac>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin"
source="${source}" target="${target}">
<src path="gen"/>
<classpath refid="CalculatorApplication.classpath"/>
</javac>
</target>
<target description="Build all projects which reference this
project. Useful to propagate changes." name="build-refprojects">
<ant antfile="${CalculatorApplicationTest.location}/build.xml"
dir="${CalculatorApplicationTest.location}" inheritAll="false"
target="clean"/>
<ant antfile="${CalculatorApplicationTest.location}/build.xml"
dir="${CalculatorApplicationTest.location}" inheritAll="false"
target="build">
<propertyset>
<propertyref name="build.compiler"/>
</propertyset>
</ant>
</target>
<target description="copy Eclipse compiler jars to ant lib
directory" name="init-eclipse-compiler">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins"
includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins"
includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target description="compile project with Eclipse compiler"
name="build-eclipse-compiler">
<property name="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
</project>
------------------------------------------------------------------------------------------------------------------------------------------------------------
And used <ant build> command for performing the build
I got following error:
------------------------------------------------------------------------------------------------------------------------------------------------------------
Buildfile: E:\Android Examples\CalculatorApplication\build.xml
build-subprojects:
init:
[mkdir] Created dir: E:\Android Examples\CalculatorApplication\bin
build-project:
[echo] CalculatorApplication: E:\Android Examples
\CalculatorApplication\build.xml
[javac] Compiling 3 source files to E:\Android Examples
\CalculatorApplication\bin
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\AboutActivity.java:22: package R does not exist
[javac] setContentView(R.layout.about_layout);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\AboutActivity.java:23: package R does not exist
[javac] Button b = (Button)
findViewById(R.id.btnClick2);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\AboutActivity.java:24: package R does not exist
[javac] TextView tvn = (TextView)
findViewById(R.id.txtVName);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:27: package R does not exist
[javac] setContentView(R.layout.main);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:29: package R does not exist
[javac] leftOperand =
(EditText)findViewById(R.id.leftOperand);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:30: package R does not exist
[javac] rightOperand =
(EditText)findViewById(R.id.rightOperand);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:31: package R does not exist
[javac] result = (TextView)findViewById(R.id.result);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:33: package R does not exist
[javac] Button plus = (Button)findViewById(R.id.plus);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:36: package R does not exist
[javac] Button minus = (Button)findViewById(R.id.minus);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:40: package R does not exist
[javac] Button multiply =
(Button)findViewById(R.id.multiply);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:44: package R does not exist
[javac] Button divide = (Button)findViewById(R.id.divide);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:47: package R does not exist
[javac] Button clear = (Button)findViewById(R.id.clear);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:50: package R does not exist
[javac] Button about = (Button)findViewById(R.id.about);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:53: package R does not exist
[javac] Button exit = (Button)findViewById(R.id.exit);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:71: package R does not exist
[javac] if (view.getId() == R.id.plus) {
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:74: package R does not exist
[javac] else if (view.getId() == R.id.minus) {
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:77: package R does not exist
[javac] else if (view.getId() == R.id.multiply) {
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:80: package R does not exist
[javac] else if (view.getId() == R.id.divide) {
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:84: package R does not exist
[javac] else if (view.getId() == R.id.clear) {
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:90: package R does not exist
[javac] else if (view.getId()== R.id.about){
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:95: package R does not exist
[javac] else if (view.getId()== R.id.exit){
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:104: package R does not exist
[javac] setContentView(R.layout.main);
[javac] ^
[javac] E:\Android Examples\CalculatorApplication\src\org\example
\calculator\CalculatorActivity.java:105: package R does not exist
[javac] Button b = (Button) findViewById(R.id.about);
[javac] ^
[javac] 23 errors
BUILD FAILED
E:\Android Examples\CalculatorApplication\build.xml:48: Compile
failed; see the
compiler error output for details.
Total time: 2 seconds
------------------------------------------------------------------------------------------------------------------------------------------------------------
If any one can help on this pls do reply...
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en