@@ -130,8 +130,37 @@ getDefaultStoreFilePath() {
130130}
131131
132132getApktoolJarFilePath () {
133- local resourcesDirPath=$( getResourcesDirPath)
134- echo " ${resourcesDirPath} $( getFileSeparator) apktool-2.12.1.jar"
133+ local resourcesDirPath
134+ resourcesDirPath=$( getResourcesDirPath)
135+ local apktoolVersion=" 3.0.1"
136+ local jarFilePath=" ${resourcesDirPath} $( getFileSeparator) apktool-${apktoolVersion} .jar"
137+ local expectedSha256=" b947b945b4bc455609ba768d071b64d9e63834079898dbaae15b67bf03bcd362"
138+ local actualSha256
139+ if [[ -f " ${jarFilePath} " ]]; then
140+ actualSha256=$( getFileSha256 " ${jarFilePath} " )
141+ if [[ " ${actualSha256} " == " ${expectedSha256} " ]]; then
142+ echo " ${jarFilePath} "
143+ return
144+ fi
145+ rm -f " ${jarFilePath} "
146+ fi
147+ local url=" https://github.com/iBotPeaches/Apktool/releases/download/v${apktoolVersion} /apktool_${apktoolVersion} .jar"
148+ echo " ⏳ 检测到本地还未下载 apktool,开始下载 apktool-${apktoolVersion} .jar,体积较大请耐心等待..." >&2
149+ curl -L --progress-bar -o " ${jarFilePath} " " ${url} "
150+ local exitCode=$?
151+ if (( exitCode != 0 )) ; then
152+ echo " ❌ apktool-${apktoolVersion} .jar 下载失败,请检查网络或稍后重试" >&2
153+ kill -SIGTERM $$
154+ exit 1
155+ fi
156+ actualSha256=$( getFileSha256 " ${jarFilePath} " )
157+ if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
158+ rm -f " ${jarFilePath} "
159+ echo " ❌ apktool-${apktoolVersion} .jar 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} " >&2
160+ kill -SIGTERM $$
161+ exit 1
162+ fi
163+ echo " ${jarFilePath} "
135164}
136165
137166getBaksmaliJarFilePath () {
@@ -157,10 +186,8 @@ getJdGuiJarFilePath() {
157186getBundletoolJarFilePath () {
158187 local resourcesDirPath
159188 resourcesDirPath=$( getResourcesDirPath)
160- local fileSeparator
161- fileSeparator=$( getFileSeparator)
162- local version=" 1.18.3"
163- local jarFilePath=" ${resourcesDirPath}${fileSeparator} bundletool-${version} .jar"
189+ local bundletoolVersion=" 1.18.3"
190+ local jarFilePath=" ${resourcesDirPath} $( getFileSeparator) bundletool-${bundletoolVersion} .jar"
164191 local expectedSha256=" a099cfa1543f55593bc2ed16a70a7c67fe54b1747bb7301f37fdfd6d91028e29"
165192 local actualSha256
166193 if [[ -f " ${jarFilePath} " ]]; then
@@ -171,19 +198,19 @@ getBundletoolJarFilePath() {
171198 fi
172199 rm -f " ${jarFilePath} "
173200 fi
174- local url=" https://github.com/google/bundletool/releases/download/${version } /bundletool-all-${version } .jar"
175- echo " ⏳ 检测到本地还未下载 bundletool,开始下载 bundletool-all-${version } .jar,体积较大请耐心等待..." >&2
201+ local url=" https://github.com/google/bundletool/releases/download/${bundletoolVersion } /bundletool-all-${bundletoolVersion } .jar"
202+ echo " ⏳ 检测到本地还未下载 bundletool,开始下载 bundletool-all-${bundletoolVersion } .jar,体积较大请耐心等待..." >&2
176203 curl -L --progress-bar -o " ${jarFilePath} " " ${url} "
177204 local exitCode=$?
178205 if (( exitCode != 0 )) ; then
179- echo " ❌ bundletool-all-${version } .jar 下载失败,请检查网络或稍后重试" >&2
206+ echo " ❌ bundletool-all-${bundletoolVersion } .jar 下载失败,请检查网络或稍后重试" >&2
180207 kill -SIGTERM $$
181208 exit 1
182209 fi
183210 actualSha256=$( getFileSha256 " ${jarFilePath} " )
184211 if [[ " ${actualSha256} " != " ${expectedSha256} " ]]; then
185212 rm -f " ${jarFilePath} "
186- echo " ❌ bundletool-all-${version } .jar 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} " >&2
213+ echo " ❌ bundletool-all-${bundletoolVersion } .jar 文件校验失败,期望值:${expectedSha256} ,实际值:${actualSha256} " >&2
187214 kill -SIGTERM $$
188215 exit 1
189216 fi
0 commit comments