Extraction APK : what are .png# files? - java

I would like to extract the images from an android game.
Firstly, I took the APK on my windows 10 laptop then I extracted the files (rename files.apk to files.apk.zip and extracted it with 7zip).
Inside my folders I got many .png files but I get an error when I try to open one. Each .png file has another file with the same name but with .png#. Some even have 2 otherfiles with them : one with .skel (can't open this one too) and .atlas (I can open it with notepad):
Did I make mistakes? What can I do to "repair" all these png files?
Thank you for you help!

If you are authorised to do so then you can apktool.
Its easy to use and may that #png files will be converted to some meaningful resource.
Installation for Apktool
Windows:
Download Windows wrapper script (Right click, Save Link As apktool.bat)
Download apktool-2 (find newest here)
Rename downloaded jar to apktool.jar
Move both files (apktool.jar & apktool.bat) to your Windows directory (Usually C://Windows)
If you do not have access to C://Windows, you may place the two files anywhere then add that directory to your Environment Variables System PATH variable.
Try running apktool via command prompt
Link

Related

What is the right way (resp. folder) to save files under Android 11 (API30)?

My Android-APP creates text files that have to be read by other apps.
I originally chose the following directory, which no longer works:
Environment.getExternalStoragePublicDirectory((Environment.DIRECTORY_DOCUMENTS))
Right now I'm trying the directory:
getFilesDir()
The problem here is that no other app can access this folder.
I'm puzzled as I simply don't know which directory I can use for an exchange between apps.

How can I programmatically decompile dex files within Android?

I know how to extract apk files to classes using a windows based system as below:
Step 1:Renaming .apk file
Rename the .apk file with the extension .zip (for example let the file
be "demofile.apk" then after renaming it becomes "demofile.apk.zip")
Step 2:Getting java files from apk
Now extract the renamed zip file in specific folder, for example let
that folder be "demofolder". Now Download dex2jar from the link for
windows and extract that zip file in folder "demofolder".
Now open command prompt and go to the folder created in previous step
and type the command "dex2jar classes.dex" and press enter.This will
generate "classes.dex.dex2jar" file in the same folder.
Now Download java decompiler from the link and extract it and
start(double click) jd-gui.exe
From jd-gui window browse the generated "classes.dex.dex2jar" file in
demofolder, this will give all the class files by src name.
Now from the File menu select "save all sources" this will generate a
zip file named "classes_dex2jar.src.zip" consisting of all packages
and java files.
Extract that zip file (classes_dex2jar.src.zip) and you will get all
java files of the application.
Above steps will generate java files but to get xml files perform
following steps.
Step 3:Getting xml files from apk
Download apktool and apktool install from the link and extract both
files and place it in the same folder (for example "demoxmlfolder").
Place the .apk file in same folder (i.e demoxmlfolder)
Now open command prompt and goto the directory where apktool is stored
(here "demoxmlfolder") and type the command "apktool if
framework-res.apk" Above command should result in "Framework installed
..." Now in command prompt type the command "apktool d filename.apk"
(where filename is name of apk file) This will generate a folder of
name filename in current directory (here demoxmlfolder) where all xml
files would be stored in res\layout folder.
But I would like to know how to accomplish the above programatically within Android. So my android application can simply extract another app's dex file. I don't mind if the dex file is copied elsewhere on the phone, then decompiled (it is simply the decompilation I'm stuck on)
On the principle as below, that I have access to each app's dex, just not the knowledge of how to decompile it within Android.
Any help would be fantastic.
final PackageManager pm = getPackageManager();
PackageInfo packageInfo = null;
try {
packageInfo = pm.getPackageInfo("PACKAGE NAME HERE", PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
File file = new File(packageInfo.applicationInfo.sourceDir);
Uri uri = Uri.fromFile(file);
You can browse the sourcecode of the ShowJava application here. It looks like he is using the the Dex2Jar tool. The decompilation starts in a BackgroundService and all the magic happens in some special Jar classes. I do not know if this code comes from a library or if all this code is created by him. Look at the ExtractJar and the DecompileJar method than it shouldn't be to hard to understand what's going on.
You need to follow some steps in order to get it working:
Got to the dex2jar bitbucket site and download the files. Add the jar files to your project.
Via the DexFileFactory, you can load the apk, convert it to dex (loadDexFile) and save it to a file (writeDexFile).
With another library that converts jars to java-files, you can finally read the content. I found Procyon, which seems really simple. Load the class file with an InputTypeLoader and then call Decompiler.decompile().
Of course you can use other libraries in step 3, but for step 1 and 2, I haven't found any alternatives.

SDL2 Android Asset Path

I need to grab the path to the android assets folder for my SDL2 app. I keep getting file not found when I attempt to get the file directly with something simple like:
TTF_OpenFont("font.ttf", 24 );
What I assume is that I'm looking in the wrong folder (whatever the current working directory is), and that I need to prepend the assets folder path.
Using SDLActivity.getContext().getAssets().list(""); shows the file i want to load.
Ironically, loading "font.ttf.png" does not result in a FileNotFoundException (I randomly added .png as a sanity check... I'm not sure I'm sane anymore).
I have been loading them fine on other platforms (win, linux, osx).

WFMLRSVCApp.ear file not found

I am trying to install Oracle 11g in my laptop. Im downloading the setup files from here:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win64soft-094461.html
I have downloaded win64_11gR2_database_1of2.zip and win64_11gR2_database_2of2.zip.
I have put them in the same folder and started the setup file from the 1of2 folder. I go until certain steps and finally during installation i get WFMLRSVCApp.ear file not found popup.
I googled and i see some solutions where 1of2 and 2of2 file should be unzipped to same folder and then start setup. I did the same couple of times but still im getting the same error. Any anyone guess what is missing?
extract win64_11gR2_database_1of2.zip into win64_11gR2_database_1of2 folder first.
Then extract win64_11gR2_database_2of2.zip into win64_11gR2_database_2of2 folder.
copy all 4 files in database/ stage/ components folder in win64_11gR2_database_2of2 folder(unziped) & paste them (no replacement) in database/ stage/ components folder in win64_11gR2_database_1of2 (unziped).
Then run the setup again. I experienced in it. It works..
What you have to do is copy what is inside components folder ( i think four files ) in win64_11gR2_database_2of2.zip and paste it inside the win64_11gR2_database_1of2.zip components folder and re run the setup . it works
If you are installing the Oracle Identity Management 11gR2, you might receive the WFMLRSVCApp.ear file missing during Installation error during the database installation.
The way to resolve this error is:
Make sure you downloaded two disk
win64_11gR2_database_1of2.zip
win64_11gR2_database_2of2.zip
Steps:
Right click the win64_11gR2_database_1of2.zip file and select
Extract Here.
The software will extract in the folder named database as below,
You can see the following folders and files under database\stage, note the Date modifiedfor Components folder.
Do the same for win64_11gR2_database_2of2.zip file and click extract here, the extracted file will be placed in the same database folder
Now check the Date modified
That's it, now you can start by clicking setup.exe under database folder.
Hope it helps to understand easily.!!
I had the same problem but it's an easy one to solve: Download WinMerge and use it to merge the 2 folders that come out of the zip file from Oracle. That will do it.
http://winmerge.org/
1) Normally extract win64_11gR2_database_1of2.zip and win64_11gR2_database_2of2.zip
2) Copy directory
C:\Users\Fatality\Downloads\win64_11gR2_database_2of2\database\stage\Components (from extracted win64_11gR2_database_2of2 directory)
to
C:\Users\Fatality\Downloads\win64_11gR2_database_1of2\database\stage\Components (in extracted win64_11gR2_database_1of2 directory)

how to download folder containing files(pdf,png etc) from php server in android

i want to download folder containing files like pdf,jpg,png etc from web services.I have written a application that can download pdf,png file.But i want to download folder containing several files. So my question is- is it possible to download folder and if yes then how can i download folder from server in android. thank you
If you can download one file, why wouldn't you be able to download several? Create the folder on Android, queue the files and start the next download when the current is finished, filling the folder. Also Android supports ZIP, so that might be your best call.
Folder is nothing but an FILE but a different type of file. Once you get the folder you can list down the files in it. You already have URL with the folder, u just need to append the URL of the folder to the files in it and download them one by one.

Categories