Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging android code into jar file

Tags:

java

android

I am trying to package the android code into a jar file so that I can use it in another project. But when I do that I get the following error messages. I am not sure how to do this correctly if someone has done it please post a link and some details would be really helpful.

Thanks

Error generating final archive: Found duplicate file for APK: AndroidManifest.xml
Origin 1: C:\Users\Admin\workspace\Test\bin\resources.ap_
Origin 2: C:\Users\Admin\workspace\Test\lib\JarLib.jar

I have to use it in lots of project so I want to compile it as jar just like other libraries available online such as twitter4j, googleAnalytic, androidsupportlibrary and I need to know which folder are compulsory to include in Jar file. I have tried building it by excluding the resources folder and using eclipse->export, though it builds the jar but upon including it in another test project displays the above errors messages.

like image 886
user606669 Avatar asked May 17 '12 09:05

user606669


1 Answers

Better to build as a Library Project. Right click the Project( which is having common code) -> Select Properties -> Select Android Tab ->check isLibrary Option->Ok as shown below :enter image description here. You can add this as referenced project to another Project by clicking Add button in the above image. Then the Library Projects directory is created having jar file as shown below :

enter image description here

like image 133
Avadhani Y Avatar answered Oct 16 '22 02:10

Avadhani Y