android - How to link against a external jar in Ant? -


i have library uses external jar. (unity's stuff) how can link agains ant jar command succeeds? quite new ant kind of lost...

i've tried adding new property:

<property name="unity.androidplayer.jarfile" value="/applications/unity/unity.app/contents/playbackengines/androiddevelopmentplayer/bin/"/>     <path id="classpath">         <fileset dir="${unity.androidplayer.jarfile}" includes="**/*.jar"/>     </path> 

and adding "compile" target

<target name="compile"         description="compiles project's .java files .class files">   <javac encoding="ascii" debug="true">     <src path="${source.dir}" />     <classpath>       <pathelement location="${sdk.dir}\platforms\${target}\android.jar"/>       <pathelement location="${unity.androidplayer.jarfile}"/>     </classpath>   </javac> </target> 

but worse, more errors :(

i tried <zipgroupfileset dir="${unity.androidplayer.jarfile}" includes="*.jar" excludes="*.config"/> inside jar target nothing changed.

i think not adding ${unity.androidplayer.jarfile} right place.

originally build.xml looks , adding symbolic library libs/ think not optimal solution.

<?xml version="1.0" encoding="utf-8"?> <project name="myfirstapp" default="help">  <property file="local.properties" /> <property file="ant.properties" /> <property environment="env" /> <condition property="sdk.dir" value="${env.android_home}">     <isset property="env.android_home" /> </condition>  <loadproperties srcfile="project.properties" />  <fail         message="sdk.dir missing. make sure blah blah..."         unless="sdk.dir" />  <!-- jar target make library --> <target name="jar" depends="debug">   <jar       destfile="bin/mysuperlibrary.jar"       basedir="bin/classes"       includes="net/mycompany/myapp/*"       /> </target>  <import file="custom_rules.xml" optional="true" />  <import file="${sdk.dir}/tools/ant/build.xml" /> 

any highly appreciated

update

this result get:

$ ant jar buildfile: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/build.xml  -set-mode-check:  -set-debug-files:  -check-env:  [checkenv] android sdk tools revision 22.6.2  [checkenv] installed @ /users/guillermo.enriquez/downloads/adt-bundle-mac-x86_64-20140321/sdk  -setup:      [echo] project name: myfirstapp   [gettype] project type: application  -set-debug-mode:  -debug-obfuscation-check:  -pre-build:  -build-setup: [getbuildtools] using latest build tools: 19.0.3      [echo] resolving build target myfirstapp... [gettarget] project target:   android 4.4.2 [gettarget] api level:        19      [echo] ----------      [echo] creating output directories if needed...     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin/res     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin/rsobj     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin/rslibs     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/gen     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin/classes     [mkdir] created dir: /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin/dexedlibs      [echo] ----------      [echo] resolving dependencies myfirstapp... [dependency] library dependencies: [dependency] no libraries [dependency]  [dependency] ------------------      [echo] ----------      [echo] building libraries 'debug'...    [subant] no sub-builds iterate on  -code-gen: [mergemanifest] merging androidmanifest files one. [mergemanifest] manifest merger disabled. using project manifest only.      [echo] handling aidl files...      [aidl] no aidl files compile.      [echo] ----------      [echo] handling renderscript files...      [echo] ----------      [echo] handling resources...      [aapt] generating resource ids...      [echo] ----------      [echo] handling buildconfig class... [buildconfig] generating buildconfig class.  -pre-compile:  -compile:     [javac] compiling 4 source files /users/guillermo.enriquez/documents/github/mycompany/myapp/android/bin/classes     [javac] /users/guillermo.enriquez/documents/github/mycompany/myapp/android/src/com/mycompany/myapp/mysource.java:22: package com.unity3d.player not exist     [javac] import com.unity3d.player.unityplayer;     [javac]                          ^ 

the logs suggests problem related javac not being able find libraries in specified classpath. give try in build file.

  <path id="android">     <fileset dir="${sdk.dir}\platforms\${target}">       <include name="*.jar"/>     </fileset>   </path>    <path id="unity">     <fileset dir="${unity.androidplayer.jarfile}">       <include name="*.jar"/>     </fileset>   </path> 

...

  <javac encoding="ascii" debug="true">     <src path="${source.dir}" />     <classpath>         <path refid="android"/>         <path refid="unity"/>     </classpath>   </javac> 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -