简体   繁体   English

linux命令“android”:相当于Windows?

[英]linux command “android” : equivalent in Windows?

i'm use to linux environment but at the moment i have to develop an android app under a windows environment. 我已经习惯了linux环境,但目前我必须在windows环境下开发一个Android应用程序。

So i need to run the "android" command ( android.bat ) in the windows prompt ( located in $ANDROID_HOME/tools/ ) in order to add ant script and do other stuffs. 所以我需要在Windows提示符(位于$ ANDROID_HOME / tools /)中运行“android”命令( android.bat ),以便添加ant脚本并执行其他操作。

the thing is that this launches me the Android SDK Manager, instead of giving me command line answer lie : "project updated"... So my question is : 问题是,这启动了我的Android SDK管理器,而不是给我命令行答案谎言:“项目更新”...所以我的问题是:

How do i run the android command under Windows ?? 我如何在Windows下运行android命令? to run things such as : 运行如下的事情:

android update project --path android更新项目--path

Maybe i'm not running the right bat file ? 也许我没有运行正确的bat文件? I did many search over the internet, without finding any answers. 我做了很多搜索互联网,没有找到任何答案。

I managed to make work Ant perfectly though, with the " ant.bat " that is located in the ant directory 我设法使Ant工作完美,使用位于ant目录中的“ ant.bat

EDIT : 编辑:

Problem solved. 问题解决了。

instead of typing : 而不是输入:

android update project --path XXX android更新项目 - 路径XXX

in the $ANDROID_HOME/tools/ directory, which would open me the SDK Manager, i had to do : 在$ ANDROID_HOME / tools /目录中,它会打开我的SDK Manager,我必须这样做:

android.bat update project --path XXX android.bat更新项目 - 路径XXX

You can make it even easier by setting the ANDROID_HOME environment variable to the path to the sdk directory and then adding the paths for tools and platform-tools to your system PATH environment variable. 通过将ANDROID_HOME环境变量设置为sdk目录的路径,然后将工具和平台工具的路径添加到系统PATH环境变量,可以使其更加轻松。

Then you can run the command android instead of android.bat from the command line, as you are used to, without having to type the full path or change to the sdk directory. 然后,您可以像以前一样从命令行运行android而不是android.bat命令,而无需键入完整路径或更改为sdk目录。

There are instructions for setting Windows environment variables here . 这里有关于设置Windows环境变量的说明

I have encountered same problem in Windows. 我在Windows中遇到过同样的问题。 I did it this way and it works for me . 我是这样做的,它对我有用。

   $ $ANDROID_SDK/sdk/tools/android.bat update project -p .
     Updated local.properties
     Updated file C:\ndk\android-ndk-r9b\samples\hello-jni\proguard-project.txt
     It seems that there are sub-projects. If you want to update them
     please use the --subprojects parameter

Here first used "cd" command to go the ndk project directory that is way I used "."(dot) for path(-p) 这里首先使用“cd”命令进入ndk项目目录,这是我用“。”(点)路径(-p)的方式

$ANDROID_SDK/sdk/tools/android.bat update project -p .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM