Guest User

Untitled

a guest
May 21st, 2020
6
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set formattedDate to (do shell script "date +'%Y-%m-%d-%H.%M.%S'")
  2.  
  3. set zipfolder to choose folder with prompt "Folder containing zipalign and apksigner"
  4. set zipfolderpos to POSIX path of zipfolder
  5.  
  6. set unsignedapk to choose file with prompt "Location of unsigned apk"
  7. set unsignedapkpos to POSIX path of unsignedapk as text
  8. set zippedpath to text 1 thru -5 of unsignedapkpos
  9. set zippedapk to zippedpath & "_" & formattedDate & "_zipaligned" & ".apk"
  10. set signedapk to zippedpath & "_" & formattedDate & "_signed" & ".apk"
  11.  
  12. set keystore to choose file with prompt "Location of keystore"
  13. set keystorepos to POSIX path of keystore
  14. set keypassword to text returned of (display dialog "Keystore password:" default answer "" with hidden answer)
  15.  
  16. do shell script zipfolderpos & "/zipalign -v 4 " & unsignedapkpos & " " & zippedapk
  17. do shell script zipfolderpos & "/apksigner sign --ks " & keystorepos & " --ks-pass pass:" & keypassword & " --in " & zippedapk & " --out " & signedapk
  18.  
  19. tell application "System Events" to if (exists file zippedapk) then delete file zippedapk
  20.  
  21.  
  22. display dialog "All done! Your signed apk can be found at: " & signedapk & "."
RAW Paste Data