Mustafa ELnagar
Mustafa ELnagar

Reputation: 492

"phonegap run android" phonegap 3 under windows can't build a project

I 'm trying to create a new project with phonegap3 :- I set up the dev environment that include

and they all updated to the last versions after creating the project , I get the directory for project: EX :

     phonegap create HelloWorld com.example.hello HelloWorld

but the main problem that I can't add the android platform to it

with the 3 comands as follow :-

trying to "phonegap add platform android"/"phonegap build android"/"phonegap run android"

I also installed throw the node the "cordova" and the same problem exists when I replace the phonegap with cordova !

     Users\koko\test\www>phonegap build android
     [ponegap] detecting Android SDK environment...
     [ponegap] using the local environment
     [onegap] adding the Android platform...
     [error] An error occured during creation of android sub-project.

     Users\koko\.cordova\lib\android\cordova\3.3.0\bin\node_modules\q\q.js:126
             throw e;
                   ^
     Error: An error occurred while listing Android targets
      at C:\Users\koko\.cordova\lib\android\cordova\3.3.0\bin\lib\check_reqs.js:87:29
      at _rejected (C:\Users\koko\.cordova\lib\android\cordova
      .........
      at process._tickCallback (node.js:415:13)

I also uninstall the node and re-download it and the problem still exists ! I viewed many questions with people around this issue but I don't know where exactly the error ! I wish to see the project running inside the emulator !

Upvotes: 1

Views: 2544

Answers (2)

user2445933
user2445933

Reputation:

It seems, that cordova failed to execute following command in shell:

>android list target

Why don't you try to execute it manually? It may produce more information about this problem.

Didn't you forget to add following folders to your PATH?

  • android-sdk/tools
  • android-sdk/platform-tools

EDIT:

The latest android SDK has different folder structure. note the "sdk" folder.

  • android-sdk/sdk/tools
  • android-sdk/sdk/platform-tools

Upvotes: 2

AxXxel001
AxXxel001

Reputation: 11

Make sure, you have set the following system variables:

ANT_HOME = path to ant files JAVA_HOME = path to java JDK (NOT JRE!!) ANDROID_HOME = path to android sdk

After that, you have to add

  • %ANT_HOME%\bin
  • %JAVA_HOME%\bin
  • %ANDROID_HOME%\bin

to your PATH variable.

If it still doesnt work, make sure you have the Google USB Driver installed (this took me hours to find and fix -.-)

Upvotes: 0

Related Questions