c# - 在Google Play商店中提交 “500 No individual errors”的原因

标签 c# google-play google-api-dotnet-client

我在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";
        }

Deployedits.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/

相关文章:

c# - 使用 F# 将我的 dll 文件放在哪里

c# - 在 C# 中用同一位置的图像替换文本

c# - 如何从指定级别获取 json 节点?

c# - 在解决方案资源管理器中创建子项

android - 是否值得添加排行榜?

android - Samsung Galaxy Tab 上的 Android Market 中未显示的应用程序

android - 消耗品只能在 Unity 应用内购买中消耗一次

c# - .NET 客户端中 Google 表格中的条件格式请求

c# - 带有谷歌日历的通用 Windows 平台应用程序

c# - 如何在 .Net 的 GoogleWebAuthorizationBroker.AuthorizeAsync 方法中发送存储为 json 字符串(在数据库中)的 Google 驱动 token ?