Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cutting down a .jar file to lighten an Android app

Background: In the process of creating an android application, I am messing around with different hashing techniques and speeds. I was using the Android native stuff until I found SpongyCastle ( i.e. BouncyCastle ), which turned out to be a lot faster. The SpongyCastle .jar file is fairly large, and my .apk is over 800kb with just the jar and a couple of testing classes ( and all of the necessary android fluff).

Question pt 1: Is this normal for .jar files to do to an APK? Do they usually bloat out the file?

Question pt 2: Is there any way for me ( either via source or jar ) to cut down the file? I'm only using the SHA256 and SHA1 hash schemes, and I have not been able to figure out how to use just those two hash schemes without including the entire jar.

Thoughts?

Edited: ProGuard works wonders.

like image 296
Phill.Zitt Avatar asked Oct 07 '22 06:10

Phill.Zitt


1 Answers

Use ProGuard. It excels at trimming down parts of dependencies that you don't use. It's specifically mentioned for use on Android applications here.

(I contribute to Guava, which is a pretty big library, but a lot of people want to use it for Android. We point them to ProGuard.)

like image 110
Louis Wasserman Avatar answered Oct 18 '22 07:10

Louis Wasserman