I am trying to sign apk by using apksigner and zipalign tools, which are located in jdk/bin folder. I have already set path environment variable to it. Now what I want to do is, execute some shell commands which signs my apk through java code in ubuntu. Commands are,
command-1 :
keytool -genkey -v -keystore /Desktop/my-release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias app
This command required some inputs at run time, like first name last name etc.
command-2 :
./zipalign -v 4 inputAPK.apk outputAPK.apk
command-3 :
apksigner sign --min-sdk-version 15 --ks my-release-key.jks outputAPK.apk
command-4 :
apksigner verify --min-sdk-version 15 outputAPK.apk
All above 4 commands I want to execute it through java code in ubuntu environment, how can I achieve it?