简体   繁体   中英

How to add external .jar to android project? (with certain conditions)

I need to add some external .jar files to my android project BUT

1) without using Eclipse or any other IDE (so no .classpath)

2) without copying them to /libs folder, i need them to stay where they are

How can i accomplish that? I know that ant should have this functionality but and cant find it. It would be great if there is something like adding "android.library.reference" to project.properties but for .jar instead of library project.

i am not sure that it will work for you but you can use this

    <path id="class.path">
      <fileset dir="jar_folder">
         <include name="**/*.jar" />
     </fileset>
   </path>

and you can use it in javac command as

<javac executable="${env.JAVA_HOME}/bin/javac"  encoding="utf-8" srcdir="src/" destdir="temp/" debug="on" debuglevel="lines,source,var" fork="true" memoryInitialSize="256m" memoryMaximumSize="1024m">
        <classpath refid="class.path" />
    </javac>

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