0

我需要使用grunt-phonegap-build,我以编程方式使用了此方法:

grunt.loadNpmTasks('grunt-phonegap-build');  
  grunt.initConfig({
                "phonegap-build": {
                        debug: {
                              options: {
                                    archive:"myapp.zip",
                                   "appId":"567576",
                                   "user": {
                                        "email":******,
                                        "password":******
                                        },
                                    download:'dist/android.apk'         
                               }
                         }
                  }
                });
  grunt.tasks('phonegap-build', {}, function(args) {
     grunt.log.ok('Done running tasks.');
  });

问题是在“完成运行任务”之后重复执行相同的过程。有时它会执行一次。当我按下按钮时,通过 ajax 调用此函数。我不知道,你能解释一下吗?如何解决这个问题?

终端流程:

  Running "phonegap-build:debug" (phonegap-build) task
>> Starting upload
>> Upload successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Getting download location for ios successful (HTTP 302)
>> Downloading ios app
>> Checking build status successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Downloaded ios app

Running "phonegap-build:debug" (phonegap-build) task
>> Starting upload
>> Checking build status successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Upload successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Getting download location for ios successful (HTTP 302)
>> Downloading android app
>> Checking build status successful (HTTP 200)
>> Checking build status successful (HTTP 200)
>> Downloaded android app

Done, without errors.

如果我在 CLI 中给出 grunt phonegap-build 命令,则手动进行。它工作正常。你能帮我吗?

以编程方式执行咕噜声无法正常工作

4

1 回答 1

0

请先创建默认任务,然后调用您的自定义 phonegap 任务。

如果你也在做同样的事情,而我没有发布你的完整 gruntfile,那么我可以在这里运行它

于 2016-03-23T13:11:54.187 回答