【发布时间】:2010-09-08 10:20:30
【问题描述】:
我在尝试创建 droidgap 项目时遇到了一些麻烦。 我安装了运行 droidgap 项目所需的所有东西(jdk、ruby、git bash、...),它们都运行良好。
我发现了这篇文章:phonegap android sample project not building,据说我应该尝试在“bin/droidgap”文件中找到“ant”命令添加“.bat”。问题是,在该文件中,自上一个 phonegap 版本发布以来,不存在“ant”命令调用。 我收到以下错误:
C:\Users\Zakaria\Development>droidgap gen Testing
C:\Users\Zakaria\Development\Testing>droidgap create
C:\Users\Zakaria\Development\Testing>ruby C:\Users\Zakaria\Development\phonegap-android\bin\droidgap create
'/*' is not recognized as an internal or external command,
operable program or batch file.
'Licensed' is not recognized as an internal or external command,
operable program or batch file.
'contributor' is not recognized as an internal or external command,
operable program or batch file.
'this' is not recognized as an internal or external command,
operable program or batch file.
'The' is not recognized as an internal or external command,
operable program or batch file.
'grep' is not recognized as an internal or external command,
operable program or batch file.
C:/Users/Zakaria/Development/phonegap-android/lib/classic.rb:52:in `create_android': undefined method `match' for nil:NilClass (NoMethodError)
from C:/Users/Zakaria/Development/phonegap-android/lib/classic.rb:13:in `build'
from C:/Users/Zakaria/Development/phonegap-android/lib/create.rb:9:in `initialize'
from C:/Users/Zakaria/Development/phonegap-android/bin/droidgap:24:in `new'
from C:/Users/Zakaria/Development/phonegap-android/bin/droidgap:24:in `<main>'
虽然“droidgap”内容是(这里是我无法替换 ant bu ant.bat 的地方):
#!/usr/bin/env ruby
ROOT = File.expand_path(File.dirname(__FILE__).gsub('bin',''))
require 'fileutils'
require File.join(ROOT, "lib", "generate.rb")
require File.join(ROOT, "lib", "classic.rb")
require File.join(ROOT, "lib", "create.rb")
require File.join(ROOT, "lib", "run.rb")
require File.join(ROOT, "lib", "update.rb")
require File.join(ROOT, "lib", "test.rb")
# ---------------------------------------------------------- #
# #
# command line interface #
# #
# ---------------------------------------------------------- #
# droidgap gen [app name]
Generate.new(ARGV[1]) if ARGV.first == 'gen'
# droidgap classic (for windows users mostly)
Classic.new(ARGV[1..-1]) if ARGV.first == 'classic'
# droidgap create [path to phonegap project]
Create.new(ARGV[1]) if ARGV.first == 'create'
# droidgap run [optional directory]
Run.new if ARGV.first == 'run'
# droidgap update [params]
Update.new if ARGV.first == 'update'
# droidgap log
if ARGV.first == 'log'
$stdout.sync = true
IO.popen('adb logcat') do |f|
until f.eof?
puts f.gets
end
end
end
# droidgap test
Test.new if ARGV.first == 'test'
# TODO implement these!
puts "droidgap ship not implemented" if ARGV.first == 'ship'
if ARGV.first.nil? || ARGV.first == 'help'
help = <<-EOF
DroidGap: PhoneGap/Android Dev Script
-------------------------------------
Useful utilities for devlopers building mobile apps using PhoneGap for Android.
Usage:
droidgap <command> <parameters>
Commands:
help ...... See this message. Type help [command name] to see specific help topics.
gen ....... Generate an example PhoneGap application to current directory.
create .... Creates an Android compatible project from a www folder. Careful, this clobbers previous packaging.
classic ... Backwards support for droidgap script. Run "droidgap help classic" for more info.
run ....... Installs a valid PhoneGap Project to first device found.
log ....... Attach a logger that listens for console.log statements.
update .... Copy a fresh phonegap.jar and phonegap.js into a valid PhoneGap/Android project.
test ...... Gets edge copy of mobile-spec and runs in first device or emulator attached.
ship ...... Build and sign an APK suitable for submission to an Android Marketplace.
Quickstart:
$ droidgap gen example
$ cd example
$ droidgap create
$ cd ../example_android
$ droidgap run
Now you can launch your app and optionally start a logger with:
$ droidgap log
EOF
gen = <<-EOF
DroidGap Generate
-----------------
Generate an example PhoneGap application to path supplied or current working directory if none is supplied.
Usage:
droidgap gen [path]
EOF
run = <<-EOF
DroidGap Run
------------
Launches PhoneGap project to first device found and attaches a logger that listens for console.log statements.
Usage:
droidgap run <path>
EOF
ship = <<-EOF
DroidGap Ship
-------------
Build and sign an APK suitable for submission to an Android Marketplace.
Usage:
droidgap ship <path>
EOF
log = <<-EOF
DroidGap Log
-------------
Launches LogCat
Usage:
droidgap log
EOF
create = <<-EOF
DroidGap Create
----------------
Creates an Android compatable project from a PhoneGap project. For example, if you have MyProject with index.html this command will create MyProject-android.
Usage:
droidgap create <path>
EOF
update = <<-EOF
DroidGap Update
~~~~~~~~~~~~~~~
Builds the JS and PhoneGap Android jar file and copies them to your project.
EOF
classic = <<-EOF
DroidGap Classic
~~~~~~~~~~~~-~~~
Compatability for older droidgap scripts.
Usage:
droidgap classic [android_sdk_path] [name] [package_name] [www] [path]
android_sdk_path ... The path to your Android SDK install.
name ............... The name of your application.
package_name ....... The name of your package (For example: com.nitobi.demo)
www ................ The path to your www folder. (Wherein your HTML, CSS and JS app is.)
path ............... The path to generate the application.
EOF
puts ARGV[1].nil? ? help : eval(ARGV[1])
end
有人尝试在 Windows 上运行新的 phonegap 版本吗?
谢谢,
问候
【问题讨论】:
标签: android configuration cordova