How to make a sdk jar like admob
Greetings,
I've created an Hoptoad for Android utility tool as an Android Library Project. Is there a way that 开发者_如何学编程I can package it into a jar like the admob-sdk-android.jar?
You can do that using the java command line or when using Eclipse you can simply export to JAR.
http://viralpatel.net/blogs/2008/12/create-jar-file-in-java-eclipse.html
the idea is to take the standard build and clean the irrelevant parts:
1 create a dummy android project
2 add your code
3 compile it with ant, using the default build.xml file
4 now that you are sure that everything compiles fine, override some targets in build.xml:
<target name="-post-compile">
<delete dir="${out.absolute.dir}/classes/com/dummyprojectfiles" verbose="${verbose}" />
</target>
<target name="-package-release" depends="-dex">
</target>
<target name="release"
depends="set-release-mode, -release-obfuscation-check, -package-release, -release-prompt-for-password, -release-nosign"
if="has.keystore"
description="Builds the application.">
<signjar
jar="${obfuscate.absolute.dir}/obfuscated.jar"
signedjar="${out.unaligned.file}"
keystore="${key.store}"
storepass="${key.store.password}"
alias="${key.alias}"
keypass="${key.alias.password}"
verbose="${verbose}" />
<!-- Zip aligns the APK -->
<zipalign-helper in.package="${out.unaligned.file}" out.package="${out.release.file}" />
<echo>Release Package: ${out.release.file}</echo>
</target>
精彩评论