Phonegap 3 不适用于 Android Studio [英] Phonegap 3 doesn't work with Android Studio
问题描述
这对我来说似乎很简单,但我根本做不到.
It seems rather simple to me, but I can't do it at all.
我有 npm install -g phonegap
一切都成功并安装了 phonegap.
I have npm install -g phonegap
with everything successful and installing phonegap.
我按照这里的说明 http://phonegap.com/install/ 然后我创建了我的项目:
I have followed instructions from here http://phonegap.com/install/ i have then created my project:
C:\var\www\sexdiaries.co.uk>phonegap create sexdiaries -n SexDiaries -i co.uk.sexdiaries.app
我有,正如所告诉的 这里尝试运行andriod但出现以下错误
I have then, as told Here tried to run andriod but with the following errors
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,但这样做时我得到:未找到项目的源文件
More over, I have imported the project created into Andriod Studio, but when doing so I get: Source files for your project not found
我知道如何使用 phonegap 2.9 创建一个工作项目.但无法弄清楚 3 提供了什么?
I know how to create a working project using phonegap 2.9. But can't work out what 3 is offering?
那么问题是,我如何使用 phoengap 3 使本地 android 应用程序真正运行起来
So the question, how do I actually get a working local android app working using phoengap 3
推荐答案
经过挖掘,我发现了如何解决这个问题:
Upon must digging I found how to get past this:
phonegap run android
就这么简单.
您需要添加平台才能使用,而文档非常非常差:
You need to add platform to work with, whilst the documentation is so very very poor:
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 进行导入,因为你有一个项目要处理:)
Then you are good to go, doing an import with Andriod Studio will also work now as you have a project to work with :)
太棒了.
这篇关于Phonegap 3 不适用于 Android Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!