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 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)要在我的Android手机上运行项目,请使用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)第二点注释:上面提到的链接还包括用于从命令构建整个项目的说明。
希望这将有助于解决这个问题。我知道我很高兴在这里找到有关此主题的任何信息。