APK tool returning the content of the res folder in encrypted language - android

I have used the APKTool to decompile the apk file.
For that,first i rename the apk file to zip and then extract it to get the res folder.
Now problem is i got the res folder with its respective subfolders,but when i opened any xml file in that
i got the text in some different language (as shown below).
After that i have tried it using command line ..
but when i run the command apktool d sample.apk
i got the following error ...
D:\Softwares\apktool_2.0.0rc4>apktool d sample.apk
I: Baksmaling...
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Could not decode ars
c file
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:56)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibRes
ources.java:491)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.jav
a:74)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.jav
a:66)
at brut.androlib.Androlib.getResTable(Androlib.java:50)
at brut.androlib.ApkDecoder.getResTable(ApkDecoder.java:189)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:114)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
Caused by: java.io.IOException: Expected: 0x001c0001, got: 0x00000000
at brut.util.ExtDataInput.skipCheckInt(ExtDataInput.java:48)
at brut.androlib.res.decoder.StringBlock.read(StringBlock.java:44)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:10
2)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:83)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:49)
... 8 more
can anyone guide me towards to get the possible solution ???
your suggestion and guidance are highly appreciated...
Thanks in advance..

Related

Error: error while writing **** File name too long

I'm trying to assemble an Android build with my laptop with Ubuntu but I'm getting constantly the error on a file generated by dagger:
error: error while writing DaggerMyLibraryBookmarksComponent$com_testx_baseapplication_presentation_common_dagger_component_ApplicationComponent_userManagerRepository.class (File name too long)
This error is quite weird due that in other computers with same code and same SO I'm able to compile the project without any issue.
Has anyone experienced this issue?
The problem here was that I was using an encrypted folder in my /home partition. I just created a new folder outside the encrypted partition and the problem was solved.
This is due encrypted folders only accepts 144bytes class name files.
Same problem here!
My solution was to create a virtual image using "dd", format it in ext4 and mount it in my working folder. Worked like a charm!
Somthing like this:
https://www.tecmint.com/create-virtual-harddisk-volume-in-linux/

Error when trying to delete a folder. Input is not valid Modified UTF-8

I have a folder with some files, one of those called 'dise�o.jpg'. When I try to remove the folder with the following sentence:
FileUtils.deleteDirectory(pathUnidadRenamed);
the app crashes throwing the following error:
JNI DETECTED ERROR IN APPLICATION:
input is not valid Modified UTF-8: llegal start byte 0xa4
string: 'dise�o.jpg'in call to NewStringUTF
from java.lang.String[] java.io.File.listImpl(java.lang.String)
I already know that if I sign the app, it will not crash (but it will not remove the folder), but in this case I need to remove the folder and I do not have the possibility to rename the file due to customer requirements.
Does anyone know how to avoid that error? Any idea?
Thanks in advance.
I finally solved my problem with Runtime.getRuntime().exec( rm -r + " " + path );

Apktool error on mac

When I try to run the apktool to decompile my apk it gives off an error:
Exception in thread "main" brut.androlib.AndrolibException: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
at brut.androlib.ApkDecoder.hasSources(ApkDecoder.java:199)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:83)
at brut.apktool.Main.cmdDecode(Main.java:146)
at brut.apktool.Main.main(Main.java:77)
Caused by: brut.directory.DirectoryException: java.util.zip.ZipException: error in opening zip file
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:55)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:38)
at brut.androlib.res.util.ExtFile.getDirectory(ExtFile.java:55)
at brut.androlib.ApkDecoder.hasSources(ApkDecoder.java:197)
... 3 more
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:128)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at brut.directory.ZipRODirectory.<init>(ZipRODirectory.java:53)
... 6 more
I followed this guide. http://www.adventuresofanentrepreneur.net/creating-a-mobile-appsgames-company/how-to-unpack-pack-an-apk-file
Am I missing some files it needs to operate?
I checked all the other solution but now I found i was using jdk1.6 which was preinstalled on my machine. Maybe a java update might solve this problem. The apktool documentation explicitly mentions that it needs minimum of jdk 1.7. More info here:https://code.google.com/p/android-apktool/
try unzip your apk file first
apk is a zipfile the message said it cannot unzip the apk first
so try your self to unzip the apk file to find whether it is a real apk
This error means Apktool cannot open the Zipfile to read the files it wants (classes.dex in this case). Try using a regular Zip program (Like 7zip or Winrar) and try and unzip the apk. If this works, then apktool is at fault and you should report a bug. However, I believe it will fail, in which case you need to figure out why that is. It could be any of the following reasons:
Apk utilizes the "general access bit" hack, which no longer runs on Android, thus apktool removed support for it.
Apk has a password on it.
Apk was improperly downloaded, thus not complete

decompile framework-res.apk multiple resources exception

I'm trying to decompile some apk using apktools, but on the first step when I'm doing:
apktool if framework-res.apk
I'm getting the following log:
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources:
spec=0x01080293 drawable/ic_ab_back_holo_dark, config=-xhdpi
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:10
5)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:82)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:48)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:39)
at brut.androlib.res.AndrolibResources.installFramework(AndrolibResource
s.java:384)
at brut.androlib.Androlib.installFramework(Androlib.java:365)
at brut.apktool.Main.cmdInstallFramework(Main.java:193)
at brut.apktool.Main.main(Main.java:69)
My guess is that this apk contains lib that possess resource with the same name as the main apk's project. The question is whether I can fight and get it to work or leave it.
PS - I still can decompile the .class file using JV-GUI but I need the xmls.
Thanks
Your version of Apktools is too low. you need download apktools 1.52.

error when unzip apk file in ant

I use ant to unzip an apk file, but it occurred an error like this:
<unzip src="test.apk" dest="testdir" >
error message:
java.lang.RuntimeException: data starting at 0 is in unknown format
i googled it, and add attribute encoding="native-encoding" , it still error.
great thanks for any help!
ok,finally I wrote a custom ant task using java ziputil to unzip an apk files. It does work well.

Categories

Resources