2010-09-08 6 views
0

J'ai des problèmes lorsque j'essaie de créer un projet droidgap. J'ai installé tout ce qui est nécessaire pour exécuter un projet droidgap (jdk, ruby, git bash, ...) et tous fonctionnent parfaitement.Impossible d'exécuter la nouvelle version PhoneGap sous Windows 7

J'ai trouvé cet article: phonegap android sample project not building où il est dit que je devrais essayer d'ajouter ".bat" à la commande "ant" trouvée dans le fichier "bin/droidgap". Le problème est que dans ce fichier, l'appel de la commande "ant" n'existe pas puisque dans la dernière version phonegap a été libérée. Je reçois les erreurs suivantes:

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>' 

Alors que le contenu "droidgap" est (ici est où je ne peux pas remplacer 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 

Est-ce que quelqu'un a essayé de lancer le nouvelle version phonegap sur Windows?

Merci,

Cordialement

Répondre

1

Quelqu'un a suggéré de renommer fourmi ant.bat parce que le script droidgap est écrit dans le format script bash trouvé sur les environnements UNIX/Mac OSX. Windows n'utilise pas ce format. "ant" ne veut rien dire pour Windows, alors que "ant.bat" sera interprété comme un fichier batch et sera exécuté. Cependant, renommer les lignes dans le script est une course de folie!

Je vous suggère de télécharger gitBash. Cela imite le style bash sur un environnement Windows. Fondamentalement, c'est un programme alternatif 'cmd'. Ouvrez-le et exécutez la commande qui appelle le script droidgap comme vous le feriez pour toute autre commande.

Je suis personnellement extrêmement déçu et déçu par PhoneGap; bonne idée, exécution terrible.

+0

Total êtes d'accord avec vous. PhoneGap est une excellente idée, mais la façon dont ils nous font construire/créer un projet de modèle Android à importer à Eclipse est horrible. Il me faut plus d'une semaine pour obtenir le soutien de la communauté par Google. mais jusqu'à présent, je reçois toujours une erreur lors de la construction :( – anticafe

Questions connexes