如何轻松地将您的APK包编译并部署到Google Play商店?我一直在寻找我能找到的最简单的设置方式,最后在下面进行以下操作?你会建议一个更好的方法吗?
“您可以使用GUI在Android Studio中签名和压缩对齐APK文件,而不是使用终端吗?”
我创建的以下批处理文件是为了加快我在各种设备上测试我的APK文件,因为我还开发了一些Android到Arudino通信的人。所以我可能需要在单一更改代码/语法后准备好APK。无论如何......他们做了什么?
@echo off
REM Modify the variables between the lines to match your installation and project
REM ----------------------------------------------------
set sKeyAlias=MyProjectNameAlias
set sStorePass=MyPassword
set sPathKeyStore=C:\Projects\Android\Key_Stores.keystore
set sFileTmp=igetdeleted.apk
set sFileOutput=MyProjectName.apk
set sPathOrigAPK=C:\Projects\MyProjectFolder\MyProjectName\build\apk\MyProjectName-release-unsigned.apk
set sPathOutput=C:\Projects\Releases
set sPathJavaBin=C:\Program Files\Java\jdk1.7.0_10\bin
set sPathAnTools=C:\Program Files\Android\android-studio\sdk\tools
set sPathGradle=C:\Projects\MyProjectFolder\
set sDriveGradle=%sPathGradle:~0,2%
REM ----------------------------------------------------
REM -- Navigate to gradlew.bat folder and execute with "aR" for a release version
%sDriveGradle%
cd %sPathGradle%
call "gradlew.bat" aR
REM -- Copy the compiled APK to our output/release folder
copy "%sPathOrigAPK%" "%sPathOutput%\%sFileTmp%" /Y >nul
REM -- Sign the APK package
"%sPathJavaBin%\jarsigner.exe" -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore "%sPathKeyStore%" -storepass "%sStorePass%" "%sPathOutput%\%sFileTmp%" %sKeyAlias%
REM -- Zipalign the APK package (This creates a copy)
"%sPathAnTools%\zipalign.exe" -f -v 4 "%sPathOutput%\%sFileTmp%" "%sPathOutput%\%sFileOutput%"
REM -- Delete the original from the zipalign output the APK package
del "%sPathOutput%\%sFileTmp%"
REM -- Awaiting user input before closing the window
pause
以下批处理文件只需让您可以根据需要查看SHA1密钥或其他详细信息
@echo off
REM Modify the variables between the lines to match your installation and project
REM ----------------------------------------------------
set sKeyAlias=MyProjectNameAlias
set sStorePass=MyPassword
set sPathJavaBin=C:\Program Files\Java\jdk1.7.0_10\bin
set sPathKeyStore=C:\Projects\Android\Key_Stores.keystore
REM ----------------------------------------------------
REM -- This will use the Java keytool to display the some information about the APK including the SHA1 key as required for google
"%sPathJavaBin%\keytool" -list -v -keystore "%sPathKeyStore%" -storepass "%sStorePass%" -alias "%sKeyAlias%"
REM -- Awaiting user input before closing the window
pause
我希望这两个可以为人们提供帮助/使用