I've been working on something that requires me to extract files from a zip archive on an Android system that contains symlinks.
When I try to create an archive using zip --symlinks command on the Android filesystem, the symlinks are stored correctly.
When I try to extract the files on a Linux system, ls shows that the symlink links point to the correct place (e.g symlink -> /storage/emulated/legacy).
However, when I use unzip in the adb shell, the extracted symlink don't point to the desired location.
How can I extract the symlinks and make them point to the location they pointed before they were archived? Is it even possible?
Related
I installed android studio on my reinstalled 20.10 groovy gorilla. When I run it, I find this error:
And then I get this error if i click cancel:
Please help me solve this error.
Try to open the program from the terminal by entering the directory where the program is stored and typing open -a programNameHere. If that doesn't work, delete and reinstall the sdk.
It is more of a Linux permission related. You might have extracted android studio into /opt as they have mentioned in documentation. I can suggest few solutions.
Extract android studio in home directory of user. Make sure not to use sudo or root to extract tar. Since you are extracting in user home directory, you don't have to use root.
OR
Install (extract) Android Studio in /opt with proper permissions.
Create a new directory in /opt/android, using sudo mkdir /opt/android.
Change ownership of /opt/android directory to the current user, using sudo chown -R <USERNAME> /opt/android. Replace <USERNAME> with the current username.
Extract android studio tar file in /opt/android directory. Don't use sudo or root extract files.
PS: Above mentioned solution no. 2 is dirty solution. /opt directory is used for multi user application. To allow multiple user, we have to create system account and add current user to newly created account's group. If you are not looking for multiuser solution then go with solution 1
The goal here is to copy and paste downloaded Android SDK packages to multiple computer and run ./sdkmanager 'xxx' to install them locally (with no access to dl.google.com).
I tried ~/Library/Android/sdk/temp and ~/.android/tmp with no luck.
On linux it is in /tmp/PackageOperationX where X is a number.
MacOS
commandline sdkmanager
the temporary files will be downloaded to /private/var/folders/ when regular professional users couldn't comprehend how this decision can be made by developers of this commandline tool and MacOS, and still not informing their users in documentation
For example, to find out the file while sdkmanager is downloading the package system-images;android-29;google_apis;x86_64, with zip file named "x86_64-29_r11.zip":
lsof | grep x86_64-29_r11.zip
## output
java 5422 username 35w REG 1,7 408368096 19062984 /private/var/folders/t7/z9lknwrd31q55t9m7s4qhm140000gp/T/PackageOperation02/x86_64-29_r11.zip
Using find also can work, but if you are searching for / it will take longer, so you can try on /private directly
sudo find / -name "*x86_64-29_r11.zip*" 2> >(grep -v 'Operation not permitted' >&2)
sudo find /private -name "*x86_64-29_r11.zip*" 2> >(grep -v 'Operation not permitted' >&2)
Source for coming up with the solutions:
See what process is using a file in Mac OS X
How can I exclude all "permission denied" messages from "find"?
Android Studio SDK Manager
the location for temporary storage of packages downloaded is $HOME/Library/Android/sdk/.downloadIntermediates and will be moved to $HOME/Library/Android/sdk/.temp/PackageOperation0X for extracting operation where X is a number. These packages will be deleted once they are extracted to their respective directories.
i want to decompile my recent apk to test is it.
i run the code
C:\Users\admin\apktool d OwnApp.apk
but it's getting error with :
Input file (OwnApp.apk) was not found or was not readable.
why am i getting this?
Procedure for decoding .apk files, step-by-step method:
Step 1:
1). Make a new folder and copy over the .apk file that you want to decode.
2). Now rename the extension of this .apk file to .zip (e.g. rename from filename.apk to filename.zip) and save it.
3). Now you can access the classes.dex files, etc. At this stage you are able to see drawables but not xml and java files, so continue.
Step 2:
1). Now extract this .zip file in the same folder (or NEW FOLDER).
2). Download dex2jar and extract it to the same folder (or NEW FOLDER).
3). Move the classes.dex file into the dex2jar folder.
4). Now open command prompt and change directory to that folder (or NEW FOLDER). 5). Then write d2j-dex2jar classes.dex (for mac terminal or ubuntu write ./d2j-dex2jar.sh classes.dex) and press enter.
6). You now have the classes.dex.dex2jar file in the same folder.
7). Download java decompiler, double click on jd-gui, click on open file, and open classes.dex.dex2jar file from that folder: now you get class files.
8). Save all of these class files (In jd-gui, click File -> Save All Sources) by src name. At this stage you get the java source but the .xml files are still unreadable, so continue.
Step 3:
1). Now open another new folder
2). Put in the .apk file which you want to decode
3). Download the latest version of apktool AND apktool install window (both can be downloaded from the same link) and place them in the same folder
4). Open a command window apktool d myApp.apk (where myApp.apk denotes the filename that you want to decode)
5). now you get a file folder in that folder and can easily read the apk's xml files.
this solutions is extracted from this StactOverflow site Check Here
you can download all the required libraries from here libraries
Recompiling apk using apktool for MAC:-
Process to DeCompile APK(Android Package):
Open terminal and cd to apk directory
type su
apktool d <../../pathToMyAPK>
Process to ReCompile APK(Android Package):
Open terminal and cd to apk directory
type su
apktool b <../../pathToMyAPKFolder>
New apk is generated in pathToMyAPK/dist/NewAPP.apk
->Now we need to sign the apk to be able to port to device.
To sign an apk:
jarsigner -verbose -keystore <path of my-keystore.keystore> <path of apk> alias_name
For Decompile, Run Apktools Over CMD like C:\\example: apktool d x.apk
I am trying to implement Couch base in my android app following the couchbase tutorial link here
I need to add a config.json file to create my own database link rather than using its default database "Sync_gateway".According to explanation it should be inside bin directory inside a data folder but I can't find a bin directory as I installed sync gatway from .exe file. I don't find run it by any command other than clicking the .exe file. What I am I missing?
If you have installed sync_gateway in Windows then open the file location for the sync_gateway.exe it will be usually in the directory "C:\Program Files (x86)\Couchbase" . You have to place your configure.json in that directory . Now open windows command prompt and do 'cd C:\Program Files (x86)\Couchbase' and run the command 'sync_gateway.exe configure.json' . Ensure that your configure.json file is perfect and does not have any syntax errors. your Sync gateway will now load with your specified configure.json
I have an android apk and I deleted my source code and dont have the project again, I want to change the version code of the old apk. my question is how do I unzip and repack the apk so I can use the. am using a mac system. I saw so many things for windows but i couldnt find for mac.I need help please
unzip apk files
The simplest method is executing unzip command:
unzip xxx.apk -d xxx
A directory xxx will be generated to store unzipped files.
Actually, .apk files are same as .zip files. Execute command file XXX.apk to see that.
get readable text files from apk
If you want readable text files such as the manifest file, I would suggest you to use the apktool. We could install the apktool easily with Homebrew:
brew install apktool
then get the readable text files:
apktool d xxx.apk
after the previous command, a xxx directory contains readable text files and others would be there.
edit zip files
If you want to edit a zip file in place, the Keka might be a good option.
To give a complete answer for unpacking, editing and packing on Mac:
Unpacking / Unzipping
As Liu Tao stated, the easiest way to unpack a *.apk file on mac is to use the following command:
unzip xxx.apk -d xxx
This is because an *.apk file is nothing else than a zip file. Again, as Liu Tao stated, this can be found out with the file command.
file xxx.apk
Which will show an output that looks something like this:
xxx.apk: Zip archive data, at least v2.0 to extract
Editing
I think this is self-explanatory. Go into the folder to which you exported the *.apk contents and edit them as you would usually do.
Packing / Zipping
On Mac, this is also quite straight-forward.
You can use the zip command to pack all the files back into an *.apk file.
zip -r xxx.apk xxx/
You want to use APKTool. It will handle the unzip and rebuild for you: http://ibotpeaches.github.io/Apktool/