android' is not recognized as an internal or e

2020-01-28 08:20发布

I'm trying to get the new GCM service to work for me, so I've been following the demo as described here: http://developer.android.com/guide/google/gcm/demo.html

So far, everything works well. However, I'm supposed to build the ant files using the command line now, and that's where things stop working.

For some reason, this command $ android update project --name GCMDemo -p . --target android-16 gives me a very nice

'android' is not recognized as an internal or external command,
operable program or batch file.

Normally this can be fixed easily with a quick Google search, but I haven't found a single other user with this problem. Could someone tell me what the problem is? My educated guess is that I need to add the Android tools folder to my PATH, but I'd rather be sure first.

7条回答
萌系小妹纸
2楼-- · 2020-01-28 09:25

I resolved this issue permanently using the below steps.

OS version : windows 7 64 bit Solution : Set environment variable for android sdk and gradle

Step 1: Create new "ANDROID_HOME" User Variable Variable Name: ANDROID_HOME Variable Value C:\Users{user_name}\AppData\Local\Android\sdk\

Step 2: Create new "GRADLE_HOME" User Variable Variable Name: GRADLE_HOME Variable Value C:\Program Files\Android\Android Studio\gradle\gradle-x.x\ *Do not forget to change and gradle versions.

Step 3: Create "ANDROID_HOME" System Variable Variable Name: ANDROID_HOME Variable Value C:\Users{user_name}\AppData\Local\Android\sdk\

Step 4: Create new "GRADLE_HOME" System Variable Variable Name: GRADLE_HOME Variable Value C:\Program Files\Android\Android Studio\gradle\gradle-x.x\ *Do not forget to change and gradle versions.

Reopen the command prompt and confirm below command output : 1. gradle -v 2. android list target

查看更多
登录 后发表回答