zipalign - Sony Ericsson XPERIA X10 Mini

Could someone explain the method to zipalign please?
Best wishes.

sathkartha said:
Could someone explain the method to zipalign please?
Best wishes.
Click to expand...
Click to collapse
zipalign -f -v <alignment> old.apk new.apk
-f is overwirte old apk file if you want to keep old apk remove the -f
-v is verbose mode
if you want to check an apk to see if it is already been zipaligned
zipalign -c -v <alignment> existing.apk
again
-v for verbose
-c is confirm
THIS IS NEEDED! for the <alignment> you can best choose 4 this will give the best results so the final lines will be
zipalign -f -v 4 old.apk new.apk or ofc zipalign -v 4 old.apk
zipalign -c -v 4 existing.apk
best is to have verbose mode always on to see if there are any errors
also you need to now zipalign file is located in /tools folder from SDK
so if you added it to system32 you can use the lines above otherwise run this command first "cd /path-to-sdk/tools"
when you build apk for 1.6+ android versions you can use Ant this will be used by default when building the apk in debug mode
most apps have this but not all (Ant align and signs the apk)
when you build apk's with eclipse you can use ADT plugin which also will automaticly align and sign the output.apk for you but only if you use the wizard for exporting the apk
and never do align and then sign this will break the align
always sign and then align but this is only when you build an apk and you export it without using the wizard
now you know everything about zipaligning lol

Thank you very much.
Best wishes.
Sent from my X10mini using XDA App

and what is alignment for?

Related

[HOW TO] Install/Run Android SDK 64 Bit Native on Device

I learned about this here... http://fieldeffect.info/w/NativeCompileSDK
You can install an i386/x86_64 chroot within your existing Debian chroot using qemu-user-static to run the Android SDK on your Android phone/tablet/phablet.
1.
Get yourself a debian chroot, I recommend at least 2gb. I use DebianKit from market.
2.
You will need a X11 desktop environment and a VNC client on your device. I use androidVNC from market.
Here is my working example...
Start your Debian chroot/environment and do...
apt-get install openbox openbox-themes obmenu obconf menu menu-xdg xdg-utils xfonts-base xfonts-terminus* nautilus terminator lxappearance gmrun leafpad man-db hicolor-icon-theme tightvncserver tint2
That gives you a window manager, fonts, filebrowser, terminal emulator, text editor, theme manager, taskbar, and a VNC server.
Now lets get some GTK engines and libraries....
apt-get install gtk2-engines-auroa gtk2-engines-murrine gtk2-engines-oxygen gtk2-engines-pixbuf libgtk2.0-bin gtk3-engines-oxygen gtk3-engines-unico libgtk-3-bin
Now 7zip to handle zips and archives comfortably(put non-free in your apt sources.list)...
apt-get install p7zip p7zip-full p7zip-rar zip unzip
##The Android SDK manager, qemu, and multistrap##
apt-get install ant file openjdk-6-jre openjdk-6-jdk qemu-user-static libswt-gtk-3-java libswt-cairo-gtk-3-jni
3.
Now we can build a small x86_64 rootfs using multistrap
multistrap can use a config, have mine...
http://db.tt/hS5j3wg
Copy multistrap.conf straight into your working(pwd) directory....
cp /sdcard/Download/multistrap.conf .
Do this to avoid multistrap complaining later...
cat multistrap.conf >mstrap
mkdir /data/mnt
Determine size of rootfs for loop image..
du -hs /data/mnt/
Now make an image for x86_64 chroot
dd if=/dev/zero of=/sdcard/64bit.img bs=$(( 0x100000 )) count=YOUR IMAGE SIZE
That byte size makes your image slightly larger than the count value in Mb, for example count=78 will write 82Mb image.
mkfs.ext2 /sdcard/64bit.img
tune2fs -c0 /sdcard/64bit.img
mkdir /data/tmp
busybox mount -o loop /sdcard/64bit.img /data/tmp/
cp -r /data/mnt/* /data/tmp/
umount /data/tmp
rm -r /data/tmp/
rm -r /data/mnt/
mkdir /data/mnt
busybox mount -o loop /sdcard/64bit.img /data/mnt/
5.
Now the environment is set up and mounted, at this point install the SDK
Aim your browser to http://developer.android.com/sdk/index.html
Select "Linux" from "SDK Tools Only", thats the last thing at the bottom of the list.
cp /sdcard/Download/android-sdk_r21.0.1-linux.tgz .
7z x android-sdk_r21.0.1-linux.tgz russosv
7z x android-sdk_r21.0.1-linux.tar
Now we need a couple goodies from http://fieldeffect.info/w/NativeCompileAPK ##--Thanks to russosv from FeildEffect
These are edited from original....
#!/bin/bash
QEMU=/usr/bin/qemu-x86_64-static
64CHROOT=/data/mnt/
case "$1" in
mklinks)
if [ ! -e "./64BIT" ]; then
mkdir ./64BIT
fi
for i in $(file ./* | grep "ELF 32" | awk '{print $1}' | sed s/://g | sed s/[./]//g); do
echo "Moving $i..."
mv $i ./64BIT
ln -s ~/bin/run-64-link $i
done-
;;
*)
$QEMU $64CHROOT/lib64/ld-linux-x86_64.so.2 --library-path $64CHROOT/lib:$64CHROOT/usr/lib:$64CHROOT/usr/share/perl/5.12.4/unicore/lib:$64CHROOT/var/lib:$64CHROOT/lib/x86_64-linux-gnu:$64CHROOT/usr/lib/x86_64-linux-gnu [email protected]
;;
esac
Copy that to run-64, then...
chmod 755 run64
cp run-64 /usr/bin/
One more...
echo $(dirname $0)/64BIT/$(basename $0) [email protected]
/usr/bin/run-i386 $(dirname $0)/64BIT/$(basename $0) [email protected]
Make that run-64-link
chmod 755 run-64-link
cp run-64-link /usr/bin/
5b.
Now launch VNC server
tightvncpasswd
tightvncserver
killall Xtightvnc
cat >.vnc/xstartup<<EOF
tint2 &
terminator &
openbox-session
EOF
tightvncserver
export DISPLAY=:1
6.
Now launch the VNC client I mentioned earlier, should connect with 127.0.0.1:5901 and your password you set.
Go back to terminal or use the one launched on X11 to do...
sh android-sdk-linux/tools/android
Install at least one api.
If all went well you can now go around "debugging" yours and your friends Android devices over wifi now.
For an example, and to see it work do....
svc wifi disable(or enable) ##this turns off/on wifi
setprop service.adb.tcp.port 5555(or -1) ##this turns on/off adb over network
stop adbd
start adbd
adb connect 127.0.0.1(yours) or any other adbd addy listening on your network,
Have fun
Never did a "how to" before, go easy and I'll make corrections and answer things. Thanks for reading. Leave feedback.
Potential necro post but I believe the information is still currently valid and not readily available on searches. I've looked variations of this up for years with no luck until I hit the right search terms.
bump, and thanks.
can't believe there's no comments.
I know it's a slower than real-64-bit-pc method but not all of us have access to new hardware... or pc's. Maybe a novelty, still cool and useful if you've got the time to let the slower hardware compile.
you have preserved the scripts, original link is dead.
here is the Internet Wayback Machine cache of the original circa 2012 for reference.
http://web.archive.org/web/20120502044700/http://fieldeffect.info/w/NativeCompileAPK
appreciate you sharing.

[I9500][Discussion]Libraries, are we using all?

I9500 firmwares come with around 380mb full of libraries. I know, we need most of them in order to make sensors and innovative applications work. But the question is, are they all needed? I believe we can slim out the firmware by removing possible unwanted libraries..
Rahulrulez said:
I9500 firmwares come with around 380mb full of libraries. I know, we need most of them in order to make sensors and innovative applications work. But the question is, are they all needed? I believe we can slim out the firmware by removing possible unwanted libraries..
Click to expand...
Click to collapse
I would like to know this as well. I've tried to remove some of them that I thought shouldn't be used, but it caused problems with some apps... FC's, bootloops in some cases...
Would love to have someone that knows enough about it explain how they go about removing libraries properly or even how to go about determining what apps rely on what libraries... if that's at all possible.
Unknownforce said:
I would like to know this as well. I've tried to remove some of them that I thought shouldn't be used, but it caused problems with some apps... FC's, bootloops in some cases...
Would love to have someone that knows enough about it explain how they go about removing libraries properly or even how to go about determining what apps rely on what libraries... if that's at all possible.
Click to expand...
Click to collapse
We can do this with a little bit of grep magic.
Any time a shared object is loaded it is loaded by calling the function:
Code:
Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
If we baksmali/decomple all of the apks in question into folders we can search for all of the loadlibrary calls.
We can look for this using this command:
Code:
grep -r 'loadLibrary' ./path/to/RomFolder
In following examples I will use './' as the path. Which, in this case, is whatever the current folder is.
This just gives us a list of the files that we need to look into to see which libraries are called.
Let's look for the line with the string constant that is passed into the function by using the -B argument (show lines before the matching line):
Code:
grep -r -B 2 'loadLibrary' ./
Note: The Library name CAN be stored in the string resources, or passed another way. If you see a result at this stage that is not a string literal, you may need to look there.
Okay, so now we have a list of function names, but our output is a bit messy. Let's pipe it to grep one more time so that we can filter out the stuff that is not useful.
Code:
grep -r -B 2 'loadLibrary' ./ | grep 'const-string .*["]'
Now that's better, but we still have a lot of duplicates. We can use the sort command's -u switch to only show unique entries. (Note: this will not display any result until the command has fully completed.)
Code:
grep -r -B 2 'loadLibrary' ./ | grep 'const-string .*["]' | sort -u
And of course, we can pipe that to a file so that we can save the results.
Code:
grep -r -B 2 'loadLibrary' ./ | grep 'const-string .*["]' | sort -u > functions.txt
Awesome write up. Thanks bud! :good:
Sent from my SPH-L720 using xda app-developers app
Amazing. Now all we need is to decompile all the apks and list out which libraries are being used..
Rahulrulez said:
Amazing. Now all we need is to decompile all the apks and list out which libraries are being used..
Click to expand...
Click to collapse
When I get some time, I'm gonna write a script to go through a folder of apk's decompile them all, one at a time, pull the list of necessary libraries, append that to a text file, then delete the output (so that it doesn't burn up my mini Virtual Box's hard drive ) Then maybe put it all together in a comprehensible list of all libraries and list out all the apk's that use it. Maybe something on a Google Doc in like a spreadsheet or something.
Unknownforce said:
When I get some time, I'm gonna write a script to go through a folder of apk's decompile them all, one at a time, pull the list of necessary libraries, append that to a text file, then delete the output (so that it doesn't burn up my mini Virtual Box's hard drive ) Then maybe put it all together in a comprehensible list of all libraries and list out all the apk's that use it. Maybe something on a Google Doc in like a spreadsheet or something.
Click to expand...
Click to collapse
Yes. I already have SGS4 app information database spreadsheet. People are really helping out. I can make the script too.. but only when I get some time from my job
Rahulrulez said:
Yes. I already have SGS4 app information database spreadsheet. People are really helping out. I can make the script too.. but only when I get some time from my job
Click to expand...
Click to collapse
This script could easily be enhanced to loop forever through multiple .apk files passed as an argument using the shift command.
Don't forget to chmod this file with +x
ListReqs.sh
Code:
#!/bin/sh
# This Script will use apktool to decompile a single .apk file passed as an argument, and grep for library files that are loaded.
# replace apktool with java -jar /path/to/apktool.jar if you don't have a launcher script set up for it in path.
# You could also just as easily replace apktool d with baksmali, so as not to waste time decompiling resources.
apktool d $1 $1.out
grep -r -B 2 'loadLibrary' $1.out | grep 'const-string .*["]' | sort -u > $1.txt
rm -R $1.out
Usage:
Code:
find -name '*.apk' ./ -exec /path/to/ListReqs.sh {} \;

Deodex

As of now I have all of the sys apps deodexed and about half of the framework deodexed. I'm working to find out why i cannot complete the framework deodex. I will edit this post with downloads as I go. The first edit will be the deodexed apk's and the partial on the framework. just need to get them uploaded first.
Current thanks list is:
abcdjdj- Universal Deodexer V4
Alokbina- Universal Deodexer V4
framework- http://www.androidfilehost.com/?fid=23134718111253137
apps- http://www.androidfilehost.com/?fid=23134718111253138
xkwr27 said:
As of now I have all of the sys apps deodexed and about half of the framework deodexed. I'm working to find out why i cannot complete the framework deodex. I will edit this post with downloads as I go. The first edit will be the deodexed apk's and the partial on the framework. just need to get them uploaded first.
Current thanks list is:
abcdjdj- Universal Deodexer V4
Alokbina- Universal Deodexer V4
framework- http://www.androidfilehost.com/?fid=23134718111253137
apps- http://www.androidfilehost.com/?fid=23134718111253138
Click to expand...
Click to collapse
I managed to fully deodex this ROM: P5200XXUAMG7_P5200OXXAMG4_XEH.zip (it's for P5200 3G model)
Here is the script I wrote for deodexing:
Code:
#!/bin/bash
for f in *.odex; do
no_ext=`echo $f | sed 's/.odex//'`
echo "deodexing $no_ext"
java -Xmx512m -jar /home/android/bin/baksmali-2.0b6.jar -a 17 -d ../system/framework -x $no_ext.odex
java -Xmx512m -jar /home/android/bin/smali-2.0b6.jar -a 17 -o classes.dex out
rm -rf out
if [ -e $no_ext.apk ]
then
zip -r -q $no_ext.apk classes.dex
fi
if [ -e $no_ext.jar ]
then
zip -r -q $no_ext.jar classes.dex
fi
rm -rf classes.dex
done
I used the latest baksmali and smali. It showed some error messages for Dropbox.odex and Magazines.odex files, but these two can be deodexed as well if you remove the -a switch from baksmali and smali lines.
Hope this helps.
Thanks if you have it linked anywhere on here I'll have to look at it to make sure I am not trying to do the same work twice. but in the mean time I'll give that script a try.
I have all deodexed...
But I have a update-binary issue that lets me not install a custom rom.
Status 7
set_perm issue
or
set_symlink issue
xkwr27 said:
As of now I have all of the sys apps deodexed and about half of the framework deodexed. I'm working to find out why i cannot complete the framework deodex. I will edit this post with downloads as I go. The first edit will be the deodexed apk's and the partial on the framework. just need to get them uploaded first.
Current thanks list is:
abcdjdj- Universal Deodexer V4
Alokbina- Universal Deodexer V4
framework- http://www.androidfilehost.com/?fid=23134718111253137
apps- http://www.androidfilehost.com/?fid=23134718111253138
Click to expand...
Click to collapse
i was looking for this.. but i cant downlaod it its telling me " no mirror found" but only with this file
framework- http://www.androidfilehost.com/?fid=23134718111253137
johnso said:
i was looking for this.. but i cant downlaod it its telling me " no mirror found" but only with this file
framework- http://www.androidfilehost.com/?fid=23134718111253137
Click to expand...
Click to collapse
Well I've deleted them now... Dutch dany has them completed up in a post anyway, that's why I never bothered finishing.
Oohh to bad because the one you hsve is for p5200and the one from dutchdanny is for p5210
I just need the framework data ..
Sent from my GT-P5200 using xda app-developers app
xmaczi123 said:
I managed to fully deodex this ROM: P5200XXUAMG7_P5200OXXAMG4_XEH.zip (it's for P5200 3G model)
Here is the script I wrote for deodexing:
Code:
#!/bin/bash
for f in *.odex; do
no_ext=`echo $f | sed 's/.odex//'`
echo "deodexing $no_ext"
java -Xmx512m -jar /home/android/bin/baksmali-2.0b6.jar -a 17 -d ../system/framework -x $no_ext.odex
java -Xmx512m -jar /home/android/bin/smali-2.0b6.jar -a 17 -o classes.dex out
rm -rf out
if [ -e $no_ext.apk ]
then
zip -r -q $no_ext.apk classes.dex
fi
if [ -e $no_ext.jar ]
then
zip -r -q $no_ext.jar classes.dex
fi
rm -rf classes.dex
done
I used the latest baksmali and smali. It showed some error messages for Dropbox.odex and Magazines.odex files, but these two can be deodexed as well if you remove the -a switch from baksmali and smali lines.
Hope this helps.
Click to expand...
Click to collapse
Thanks for the info about the "a" option. Ran in to this dilemma earlier.

[Q] Android Developer AAPT help apk & signing

Any Dev out there who might be willing to assist me with my J Theme Transmogrifier app?
Specifically I must change the app to Compile and Sign Apk's on the phone in a different way
than I am doing it currently. Google has given me just 14 days to remove my current method.
For example another method I am trying uses the aapt package function and I have it running the command:
aapt package -v -f -m
-S /data/data/com.johnmcwapps.jTransCm12/apktool/jTheme_src/res
-M /data/data/com.johnmcwapps.jTransCm12/apktool/jTheme_src/AndroidManifest.xml
-A /data/data/com.johnmcwapps.jTransCm12/apktool/jTheme_src/assets
-I /data/data/com.johnmcwapps.jTransCm12/files/builder.jar
-F /mnt/sdcard/jTransmogrifier12/jRed_Cm12Theme_US.apk
It runs without errors on the phone, however it just doesn't output the Red_CM12Theme_US.apk
I have no clue why.

[Q] init.d support on Cyanogenmod 12.1

Hi,
I'm trying to run a custom init.d script on my HTC One (m7) which is running on Cyanogemod 12.1 (The problem existed already in 12.0). The problem is that none of the scripts are executed at boot time.
Looking at the "init.cm.rc" script i found the following snippets that look like the "sysinit" command should be triggered at boot time.
Code:
[...]
on post-fs-data
[...]
# Run sysinit
start sysinit
[...]
# sysinit (/system/etc/init.d)
service sysinit /system/bin/sysinit
user root
oneshot
disabled
I even tried removing the "disabled" parameter but the "sysinit" command is still not executed at boot time.
If I run the "sysinit" command on a root shell the scripts are executed as the should.
Anybody an idea what I'm missing?
Thanks in advance!
Hi.
I am also running CM12.1 on a w7dsn device, and init.d wasn't working. I was able to get it running by using the init.sh script as described here:
http://techtrickz.com/how-to/fix-xposed-framework-installation-issue-on-nexus-6/
I've just downloaded the script and run it from my sdcard, no other steps are necessary.
lfom said:
Hi.
I am also running CM12.1 on a w7dsn device, and init.d wasn't working. I was able to get it running by using the init.sh script as described here:
http://techtrickz.com/how-to/fix-xposed-framework-installation-issue-on-nexus-6/
I've just downloaded the script and run it from my sdcard, no other steps are necessary.
Click to expand...
Click to collapse
I am trying to get init.d working on d2vzw, and no luck. The script you linked to works by replacing /system/etc/install-recovery.sh, but my build has no such file. What a drag with CM...
galets said:
I am trying to get init.d working on d2vzw, and no luck. The script you linked to works by replacing /system/etc/install-recovery.sh, but my build has no such file. What a drag with CM...
Click to expand...
Click to collapse
Mine didn't have either, but after installing the script (and creating install-recovery.sh) then my scripts in init.d started to be run after every boot.
You must turn off selinux in order for init.d to work
Sent from my LG-LS980 using XDA Free mobile app
I'm using CyanogenMod 12.1 ROM on my phone, to enable the init.d you have to remove the /system/bin/sysinit then recreate the similar filename with the same content and permissions (755, root, shell).
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
run-parts /system/etc/init.d
Was it the init.rc from the boot.img initrd, or the one from the rootfs /boot.img?
Just change the permissions of all files in /etc/init.d folder to 755.
Also if you use the /data/local/userinit.sh change that to 755.
Leave the /system/bin/sysinit file as it is.
Code:
#!/system/bin/sh
export PATH=/sbin:/system/sbin:/system/bin:/system/xbin
for i in /system/etc/init.d/*; do
if [ -x $i ]; then
/system/bin/log -t sysinit Running $i
$i
fi
done
Cheers

Categories

Resources