Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
根因
app/build.gradle固定versionName 1.12.3/versionCode 1123。Releasev2.1.0的 tag 实际是ReleaseV1.12.3,源码版本就是 1.12.3;维护者只手工改了 release 标题和资产名。aapt2 实测VirtGO-2.1.0-android-arm64-v8a.apk:versionCode=1123, versionName=1.12.3。MainActivity的更新检查用!name.contains(cur) || !tag.contains(cur)(OR)。/releases/latest返回tag=ReleaseV1.12.3, name=v2.1.0;已装 1.12.3 时因 name 不含1.12.3永远提示更新,下载同一旧包,循环。v2.5.2的 release workflow 编译失败(setIgnoreCacheException方法名大小写错误),资产为手工上传,/releases/latest仍指向 v2.1.0。改动
app/build.gradle:读取-PreleaseVersionName,校验X.Y.Z,按major*1000 + minor*10 + patch计算versionCode;无参数回退1.12.3/1123。.github/workflows/build-release.yml:从 tag 解析版本(支持v/ReleaseV前缀,非法 tag 直接失败),构建注入,并在构建后用 aapt2 校验 APKversionName与 tag 一致。VersionUtils/MainActivity:版本提取与按段数值比较,更新检查 tag 优先;修复 release 编译的SetIgnoreCacheException方法名。VersionUtilsTest3 个单测。验证
1123/1.12.3;v2.5.2 →com.zcs.virtgo 252/2.5.2(非本仓库包名)。v2.1.0→2.1.0、ReleaseV1.12.3→1.12.3、v2.5.2→2.5.2、非法 tag 失败;Verify APK 校验通过/拒绝符合预期。./gradlew :app:assembleRelease -PreleaseVersionName=2.1.0→ BUILD SUCCESSFUL,aapt2:versionCode=2010, versionName=2.1.0。./gradlew :app:testDebugUnitTest→ BUILD SUCCESSFUL,3 tests / 0 failures。build.gradle后同一命令仍输出1.12.3/1123;回退 workflow 后版本断言失败、Verify APK 步骤缺失;移除VersionUtils.java后单测编译失败。未验证
local.properties和本机 SDK 32。VirtGO-2.1.0资产仍是 1.12.3,代码无法追溯修复;需维护者替换资产或发新 tag。/releases/latest指向与v2.5.2包名不一致需发布策略处理。assets[0],未改(非本 issue 根因)。修复 #412