我在C#中有一个简单的工具,该工具使用Google.Apis.AndroidPublisher.v3 nuget包将应用程序部署到内部测试轨道,这是我自动构建的最后一步。从7月中旬我编写工具开始到9月中旬为止,它一直没有问题(最近成功执行:2018-09-17)。然后,我有几个星期没有触摸应用程序了。截至上周五(2018-09-28),该工具失败并显示Google.GoogleApiException
,无内部异常,消息
Google.Apis.Requests.RequestError
[500]
No individual errors
和堆栈跟踪
at Google.Apis.Requests.ClientServiceRequest`1.<ParseResponse>d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Google.Apis.Requests.ClientServiceRequest`1.Execute()
at MyProject.Tools.PlayStoreUploader.Program.Deploy(AndroidPublisherService service, String packageName, String releaseName, FileInfo apkFile, Int32 mainObbVersionCode, FileInfo patchObbFile, String releaseNotes) in C:\dev\MyProject\Tools\MyProject.Tools.PlayStoreUploader\Program.cs:line 211
at MyProject.Tools.PlayStoreUploader.Program.Main(String[] args) in C:\dev\MyProject\Tools\MyProject.Tools.PlayStoreUploader\Program.cs:line 126
基本上完成所有工作的
Deploy
方法是 private static void Deploy(
AndroidPublisherService service,
string packageName,
string releaseName,
FileInfo apkFile,
int mainObbVersionCode,
FileInfo patchObbFile,
string releaseNotes)
{
var edits = service.Edits;
// Create a new edit
string editId = edits.Insert(null /* no body */, packageName).Execute().Id;
// Upload new apk
int apkVersion;
using (Stream strm = apkFile.OpenRead())
{
var uploadRequest = edits.Apks.Upload(packageName, editId, strm, MimeTypeApk);
uploadRequest.Upload();
apkVersion = uploadRequest.ResponseBody.VersionCode.Value;
}
// Attach an existing main obb
edits.Expansionfiles.Update(
new ExpansionFile { ReferencesVersion = mainObbVersionCode },
packageName,
editId,
apkVersion,
UpdateRequest.ExpansionFileTypeEnum.Main).
Execute();
// Attach a new patch file
if (patchObbFile != null)
{
using (Stream strm = patchObbFile.OpenRead())
{
edits.Expansionfiles.Upload(
packageName,
editId,
apkVersion,
// This Google API is clearly auto-generated by a badly written tool, because it duplicates the enums.
UploadMediaUpload.ExpansionFileTypeEnum.Patch,
strm,
MimeTypeObb).
Upload();
}
}
// Assign apk to "Internal test" track.
var release = new TrackRelease
{
Name = releaseName,
VersionCodes = new long?[] { apkVersion },
ReleaseNotes = new List<LocalizedText> { new LocalizedText { Language = "en", Text = releaseNotes } },
Status = TrackReleaseStatus.Completed
};
edits.Tracks.Update(
new Track { Releases = new List<TrackRelease> { release } },
packageName,
editId,
TrackIdentifier.Internal).
Execute();
// Publish
edits.Commit(packageName, editId).Execute();
}
相关常数是
const string MimeTypeApk = "application/vnd.android.package-archive";
const string MimeTypeObb = "application/octet-stream";
// As documented at https://developers.google.com/android-publisher/tracks
static class TrackIdentifier
{
public const string Alpha = "alpha";
public const string Beta = "beta";
public const string Internal = "internal";
public const string Production = "production";
}
// As (poorly) documented at https://developers.google.com/android-publisher/api-ref/edits/tracks#resource
// See also https://android-developers.googleblog.com/2018/06/automating-your-app-releases-with.html
static class TrackReleaseStatus
{
/// <summary>Not yet rolled out to anyone</summary>
public const string Draft = "draft";
/// <summary> For staged rollouts to a small percentage of users</summary>
public const string InProgress = "inProgress";
/// <summary> Suspends a staged rollout</summary>
public const string Halted = "halted";
/// <summary> Full rollout</summary>
public const string Completed = "completed";
}
在
Deploy
和edits.Commit(packageName, editId).Execute();
的倒数第二行抛出异常。由于早期的调用成功,因此排除了身份验证失败的原因。 edits/commit文档列出的可能的故障原因是
- You open another edit for the same app after you open this edit
- Any other user commits an edit for the app while your edit is open
- You or any other user makes a change to the app through the Developer Console while your edit is open
但我确定这些都不适用。
还有什么能解释为什么我可以设置编辑,包括上传APK和OBB,但不能提交呢?
最佳答案
这听起来像Play控制台中的错误,如500 error code所示,它表示“内部错误”。
如果发生这种情况,建议您与Play控制台支持联系,以使他们知道问题所在。您可以通过Play控制台中“?”后面的帮助菜单进行操作。 (问号)图标。
关于c# - 在Google Play商店中提交 “500 No individual errors”的原因,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52592937/