ApkClean - Remove unused resources from apk

rodrigocorsi

Member
Apr 24, 2010
25
10
23
São Paulo
The low memory of the older phones, impeding the development of new roms.

Almost every application should provide alternative resources to support specific device configurations. In apk has alternative drawable resources for different screen densities and alternative string resources for different languages. At runtime, Android detects the current device configuration and loads the appropriate resources for your application.

The apkclean removes unused resources for the device

Please look at the project and testing if possible :good:

http://code.google.com/p/apkclean/
 

bloodofJesus

Senior Member
Feb 3, 2015
426
150
0
29
Kampala
creativechili.agency
The low memory of the older phones, impeding the development of new roms.

Almost every application should provide alternative resources to support specific device configurations. In apk has alternative drawable resources for different screen densities and alternative string resources for different languages. At runtime, Android detects the current device configuration and loads the appropriate resources for your application.

The apkclean removes unused resources for the device

Please look at the project and testing if possible :good:

http://code.google.com/p/apkclean/
This is an awesome tool! are you planning on updating it ? if not, I'd like to write a bash script to do this for my specific device because this is the error I get, decompiling the jar is too much trouble and I dont like java;

> ./apkclean.sh -w 400 -h 800 -d 240 -a 17 SecSettings.apk
Resolution:400x800
Dpi:240
smallestWidth:266dp
Available width/height:266dp / 533dp
Screen size:small
Screen aspect:long
Screen pixel density:hdpi
Platform Version (API level): v17
Touch:true
Querty:false
12-key keyboard:false
D-Pad:false
Trackball:false

File:/home/jesus/android/CUSTOMROM/apkclean/SecSettings.apk
Apktool method
Total size removed:3.0MB
Feb 27, 2015 8:57:54 PM brut.androlib.Androlib decodeSourcesRaw
INFO: Copying raw classes.dex file...
Feb 27, 2015 8:57:54 PM brut.androlib.res.AndrolibResources loadMainPkg
INFO: Loading resource table...
Feb 27, 2015 8:58:00 PM brut.androlib.res.AndrolibResources loadMainPkg
INFO: Loaded.
Feb 27, 2015 8:58:00 PM brut.androlib.res.AndrolibResources loadFrameworkPkg
INFO: Loading resource table from file: /home/jesus/apktool/framework/1.apk
Feb 27, 2015 8:58:03 PM brut.androlib.res.decoder.AXmlResourceParser getAttributeValue
WARNING: Could not decode attr value, using undecoded value instead: ns=android, name=sharedUserId, value=0x00000030
brut.androlib.AndrolibException: Multiple resources: spec=0x01080350 drawable/ic_ab_back_holo_dark, config=-hdpi
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:65)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:58)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:196)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:165)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:130)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:105)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:315)
at brut.androlib.res.AndrolibResources.loadFrameworkPkg(AndrolibResources.java:81)
at brut.androlib.res.data.ResTable.getPackage(ResTable.java:72)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:55)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:51)
at brut.androlib.res.decoder.ResAttrDecoder.decode(ResAttrDecoder.java:35)
at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(AXmlResourceParser.java:315)
at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(XmlPullParserDelegate.java:69)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:46)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:114)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at com.rodrigo.apkclean.Main.Descompress(Main.java:553)
at com.rodrigo.apkclean.Main.startCleanApkApktool(Main.java:313)
at com.rodrigo.apkclean.Main.main(Main.java:239)

Exception in thread "main" java.lang.NullPointerException
at java.io.Writer.write(Writer.java:157)
at brut.androlib.res.util.ExtMXSerializer.writeAttributeValue(ExtMXSerializer.java:38)
at org.xmlpull.mxp1_serializer.MXSerializer.attribute(MXSerializer.java:673)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSerializerDelegate.java:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:46)
at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:34)
at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:100)
at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:114)
at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:93)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:98)
at com.rodrigo.apkclean.Main.Descompress(Main.java:553)
at com.rodrigo.apkclean.Main.startCleanApkApktool(Main.java:313)
at com.rodrigo.apkclean.Main.main(Main.java:239)