1

这对我来说似乎很简单,但我根本做不到。

我已经npm install -g phonegap成功并安装了phonegap。

我已按照此处http://phonegap.com/install/的说明进行操作,然后创建了我的项目:

C:\var\www\sexdiaries.co.uk>phonegap create sexdiaries -n SexDiaries -i co.uk.sexdiaries.app

然后,我已经告诉Here试图运行andriod但出现以下错误

C:\var\www\sexdiaries.co.uk\sexdiaries>phonegap run andriod

C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\lib\phonegap\run.js:72
    self.phonegap.emit('log', 'detecting', platform.human, 'SDK environment...
                                                   ^
TypeError: Cannot read property 'human' of undefined
    at RunCommand.execute (C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\lib\phonegap\run.js:72:52)
    at RunCommand.run (C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\lib\phonegap\run.js:55:10)
    at PhoneGap.run (C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\lib\phonegap\util\command.js:28:25)
    at CLI.module.exports [as run] (C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\lib\cli\run.js:38:14)
    at CLI.module.exports [as argv] (C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\lib\cli\argv.js:66:17)
    at Object.<anonymous> (C:\Users\Hutber\AppData\Roaming\npm\node_modules\phonegap\bin\phonegap.js:24:21)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

此外,我已将创建的项目导入 Andriod Studio,但这样做时我得到:Source files for your project not found

我知道如何使用 phonegap 2.9 创建一个工作项目。但是无法弄清楚 3 提供了什么?

所以问题是,我如何真正让一个使用 phoengap 3 的本地 android 应用程序工作

4

3 回答 3

10

该命令是“phonegap run android”,而不是“phonegap run andriod”。再试一遍。我和你一样有这个问题。

于 2013-08-30T15:17:10.597 回答
2

在必须挖掘后,我发现如何解决这个问题:

phonegap run android

就这么简单。

[编辑]

您需要添加要使用的平台,而文档非常非常差:

C:\var\www\sexdiaries.co.uk\sexdiaries>phonegap build android
[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
 [warning] missing library cordova/android/3.0.0
[phonegap] downloading https://git-wip-us.apache.org/repos/asf?p=cordova-android.git;a=snapshot;h=3.0.0;sf=tgz...
[phonegap] compiling Android...
[phonegap] successfully compiled Android app

那么你就可以开始了,使用 Andriod Studio 进行导入现在也可以工作,因为你有一个项目可以使用:)

极好的。

于 2013-08-24T22:30:19.157 回答
2

我已经将 phonegap 3.0 与 Android Studio 一起使用,并且工作正常。请通过这个

于 2014-01-21T17:52:31.543 回答