Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set formattedDate to (do shell script "date +'%Y-%m-%d-%H.%M.%S'")
- set zipfolder to choose folder with prompt "Folder containing zipalign and apksigner"
- set zipfolderpos to POSIX path of zipfolder
- set unsignedapk to choose file with prompt "Location of unsigned apk"
- set unsignedapkpos to POSIX path of unsignedapk as text
- set zippedpath to text 1 thru -5 of unsignedapkpos
- set zippedapk to zippedpath & "_" & formattedDate & "_zipaligned" & ".apk"
- set signedapk to zippedpath & "_" & formattedDate & "_signed" & ".apk"
- set keystore to choose file with prompt "Location of keystore"
- set keystorepos to POSIX path of keystore
- set keypassword to text returned of (display dialog "Keystore password:" default answer "" with hidden answer)
- do shell script zipfolderpos & "/zipalign -v 4 " & unsignedapkpos & " " & zippedapk
- do shell script zipfolderpos & "/apksigner sign --ks " & keystorepos & " --ks-pass pass:" & keypassword & " --in " & zippedapk & " --out " & signedapk
- tell application "System Events" to if (exists file zippedapk) then delete file zippedapk
- display dialog "All done! Your signed apk can be found at: " & signedapk & "."
Add Comment
Please, Sign In to add comment