27 年后,我也对在 IDE 中进行开发感到不舒服。我尝试了这些建议(上图)——可能只是没有正确地遵循一切——所以我进行了网络搜索,并在“http://incise.org/android-development-on-the-command-line.html”找到了对我有用的方法。
答案似乎是上述所有答案的组合(如果我错了,请告诉我,如果错了,请接受我的道歉)。
如上所述,eclipse/adt 不会创建必要的 ant 文件。为了在没有 Eclipse IDE 的情况下编译(并且不创建 ant 脚本):
1) 在您的顶级目录中生成 build.xml:
android list targets (to get target id used below)
android update project --target target_id --name project_name --path top_level_directory
** my sample project had a target_id of 1 and a project name of 't1', and
I am building from the top level directory of project
my command line looks like android update project --target 1 --name t1 --path `pwd`
2) 接下来我编译项目。我对不使用“ant”的要求有点困惑。
希望——请求者的意思是他不想编写任何 ant 脚本。我说这个
因为下一步是使用ant编译应用程序
ant target
this confused me a little bit, because i thought they were talking about the
android device, but they're not. It's the mode (debug/release)
my command line looks like ant debug
3) 要将 apk 安装到设备上,我不得不再次使用 ant:
ant target install
** my command line looked like ant debug install
4) 要在我的安卓手机上运行该项目,我使用 adb。
adb shell 'am start -n your.project.name/.activity'
** Again there was some confusion as to what exactly I had to use for project
My command line looked like adb shell 'am start -n com.example.t1/.MainActivity'
I also found that if you type 'adb shell' you get put to a cli shell interface
where you can do just about anything from there.
3A) 附注:查看设备使用日志:
adb logcat
3B) 第二个附注:上面提到的链接还包括从命令构建整个项目的说明。
希望这将有助于解决这个问题。我知道我真的很高兴在这里找到有关此主题的任何内容。