【发布时间】:2020-10-08 09:17:47
【问题描述】:
我目前正在尝试在“Fastlane”的帮助下设置持续集成。 该项目已准备好构建并上传到 Google Play 商店。如果我手动执行此操作,一切正常。
我们希望在 Google Play 中拥有三个不同的应用(具有三个不同的标识符 [com.myapp、com.myapp.int、com.myapp.rc])。其中只有一个是公开的。其背后的原因是能够在一台设备上安装每个环境以进行测试。这当然不是实现这一目标的最优雅的方式。但我相信是the only one,而且可能不是没有原因的。
所以我能够为不同的环境构建应用程序。我目前面临的问题是,如果我想使用 Fastlane 上传它们,我只能上传标识符为 com.myapp 的一个,其他的会收到以下错误消息:
[10:57:14]: fastlane finished with errors
[!] Google Api Error: forbidden: APK has the wrong package name. - APK has the wrong package name.
这听起来很合理,因为我从未指定要更新哪个应用程序。如果我手动上传 AAB,我会导航到“Google Play 控制台”内的正确应用程序并将其上传到那里,但似乎 Fastlane 中不存在此选项(这会很奇怪)。 也很奇怪,只有其中一个可以工作,因为我什至无法选择哪个应该工作。 Google/Fastlane 如何选择我要更新的应用程序?
首先我认为该应用程序将在 json 键中指定用于 google play。但我在这篇medium 帖子中读到,它在不同的项目中都是一样的。
这是我的快速文件:
default_platform(:android)
platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end
desc "Submit a new Beta Build to Play Store"
lane :beta do
sh("cp", "../../.env.integration", "../../.env")
gradle(task: 'clean')
gradle(
task: 'bundle',
build_type: 'Release',
print_command: false,
)
upload_to_play_store(
track: 'internal'
)
end
end
这是我的应用文件:
json_key_file("~/.private_keys/google_api_key.json")
package_name("com.myapp")
for_platform :android do
for_lane :beta do
package_name("com.myapp.int")
end
end
【问题讨论】:
-
请向我们展示您的 fastlane 文件中的相关脚本。
-
@AlexanderHoffmann 我已经添加了我的 Fastfile 的内容
标签: android react-native deployment continuous-integration fastlane