上传APK并设置发布轨道

我正在尝试设置一个新的曲目并使用nodejs上传APK以进行发布..但是没有上传APK也没有曲目集。

但validation结果和所有其他步骤完全符合我的预期(根据API )。 脚本成功,但开发人员控制台没有任何变化。那么有没有一个魔术大师可以看到我的问题?

注1 :我确实手动发布了我的应用程序,因为android-publisher仅用于更新之前发布的应用程序

注2 :这之前(很久以前)工作,并且已经停止工作了一段时间,我终于开始更新所有内容

我的代码:

var google = require('googleapis').google; var Promise = require('bluebird'); var _ = require('lodash'); var settings = require('./config/settings.json'); // Enable API access into the Developer Console: https://play.google.com/apps/publish/?account=7639196906174529268#ApiAccessPlace // Create a service account // Download the JSON and save it here // Make sure the email of the JSON is added to the apps for release manager role: // https://play.google.com/apps/publish/?account=7639196906174529268#AdminPlace var key = require('./config/google-play-user.json'); // editing "scope" allowed for OAuth2 var scopes = [ 'https://www.googleapis.com/auth/androidpublisher' ]; var OAuth2 = google.auth.OAuth2; var oauth2Client = new OAuth2(); var jwtClient = new google.auth.JWT(key.client_email, null, key.private_key, scopes, null); var play = google.androidpublisher({ version: 'v3', auth: oauth2Client, params: { // default options // this is the package name for your initial app you've already set up on the Play Store packageName: settings.app.id } }); google.options({auth: oauth2Client}); // Start with a new edit. startEdit().then(function(data) { // Load our APK(in this case a Cordova APK). var standardAPK = require('fs').readFileSync('./platforms/android/build/outputs/apk/android-release.apk'); // Stage the upload (doesn't actually upload anything). return upload({ edit: data.edit, apk: standardAPK, key: 'standardApk' }); }).then(function(data) { // Set our track. return setTrack(data); }).then(function(data) { // Validate our changes. return validateToPlayStore(data); }).then(function(data) { console.log('Successful uploaded APK files:', data); }).catch(function(err) { console.log(err); process.exit(1); }); /** * Sets our authorization token and begins an edit transaction. */ function startEdit() { return new Promise(function(resolve, reject) { jwtClient.authorize(function(err, tokens) { if (err) { console.log(err); process.exit(1); return; } // Set the credentials before we doing anything. oauth2Client.setCredentials(tokens); play.edits.insert({ packageName: settings.app.id }, function(err, edit) { if (err || !edit) { reject(err); } resolve({ edit: edit.data }); }); }); }); } /** * Stages an upload of the APK (but doesn't actually upload anything) */ function upload(data) { var edit = data.edit; var apk = data.apk; var key = data.key; return new Promise(function(resolve, reject) { play.edits.apks.upload({ editId: edit.id, packageName: settings.app.id, media: { mimeType: 'application/vnd.android.package-archive', body: apk } }, function(err, res) { if (err || !res) { reject(err); } // Pass any data we care about to the next function call. var obj = {}; obj[key] = res.data; resolve(_.omit(_.extend(data, obj), 'apk')); }); }); } /** * Sets our track (beta, production, etc.) */ function setTrack(data) { var edit = data.edit; var track = 'production'; return new Promise(function(resolve, reject) { play.edits.tracks.update({ editId: edit.id, track: track, packageName: settings.app.id }, function(err, res) { if (err || !res) { reject(err); } resolve(_.extend(data, {setTrackResults: res.data})); }); }); } /** * Validates our edit transaction and makes our changes live. */ function validateToPlayStore(data) { return new Promise(function(resolve, reject) { // play.edits.commit({ // Commit will set the change LIVE play.edits.validate({ // Validate will only validate it, not set it LIVE. editId: data.edit.id, packageName: settings.app.id }, function(err, res) { if (err || !res) { reject(err); } resolve(_.extend(data, {validateToPlayStoreResults: res.data})); }); }); } 

来自http://frontendcollisionblog.com/javascript/2015/12/26/using-nodejs-to-upload-app-to-google-play.html,当它仍然有效时