在 ubuntu 中运行 Android,无需 netbean 或 eclipse
我一直在Windows 7下使用netbeans学习Android。我使用netbeans IDE打开一个android项目,调试,运行。为了对代码进行任何更改,我使用了 gvim。现在我已经用 ubuntu LTS (10.04) 更改了我的操作系统。由于某些原因,我只需要依赖命令行编译。所以我不能有 Eclipse 或 Netbeans。
我已经正确安装了一切。当我在命令行中输入 Android 时,模拟器会显示出来。我已经使用命令行创建了 hello world。我点击了这些链接..
http://developer.android.com/guide /developing/projects/projects-cmdline.html http://developer.android.com/guide/developing/building/building-cmdline.html
我安装应用程序(.apk)并通过模拟器运行。这是第一次被毁。但是当我更改任何代码时,它并不像单击“构建并运行”这样的 netbeans IDE 按钮那么容易。当我再次运行(命令:ant debug / adb install .apk
)时,它说它已经安装了。我还想通过命令行运行示例程序(随android下载一起提供)并通过模拟器运行它。但是,当我发出命令“ant debug”时,没有找到构建文件,因为这些示例只有 /res
和 /src
以及主要的拳头 xml。
有没有什么简单的方法可以用命令行编译和运行程序?对于一个非常简单的更改来查看输出,我是否必须经历所有这些长命令行过程?
I have been learning Android under windows 7 with netbeans. I used netbeans IDE for opening a android project, debug, run. For making any change in the code i used gvim. Now i have changed my OS with ubuntu LTS (10.04). I need to depend only on command line compilation due to some reasons. So i can not have either eclipse or netbeans.
I have installed everything correctly. When I give Android in the command line the emulator shows up..I have created hello world with command line. I followed these links..
http://developer.android.com/guide/developing/projects/projects-cmdline.html
http://developer.android.com/guide/developing/building/building-cmdline.html
I install the app (.apk) and run through emulator. It is ruing for the first time. But when i change any code then its not as easy like the netbeans IDE button clicks like "build and run". When I run again (command: ant debug / adb install .apk
) it says that it has been already install. I also wanted to run the sample programs (comes along with android download) through cmd line and run it through emulator. But when I give my command "ant debug" no build file found because those sample have only /res
and /src
with main fist xml.
Is there any easy way to compile and run programs with command line? For a very simple change to see the output do i have to go through all these long command line process?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有什么问题,你需要阅读adb命令的帮助
adb install -r 你的apk
There is nothing wrong, you need read help of adb command
adb install -r your-apk
您应该能够生成 build.xml 并使用 ant 按照说明编译代码 此处。您可以深入研究这些链接以了解有关命令行构建的更多信息。然后你可以使用 adb 命令将其加载到手机上。
You should be able to generate a build.xml and use ant to compile your code following the instructions here. You can dig deeper in those links to learn more about commandline builds. Then you can load it on handset using adb commands.
尝试从您的项目文件夹运行它。
Try running this from your project folder.
这有点过时了,因为现在你使用 gradle。如果您仍然使用 ant,您可以尝试使用此命令来代替命令(“
ant debug / adb install .apk
”),这会结合您的两个命令,并且如果软件包已存在,还会重新安装。
如果你使用 gradle,你可以这样做
(这是来自一个关于如何在 gradle 上执行此操作的问题。也在那里投票,如果你使用这个)
This is all a bit outdated, as nowadays you use gradle. If you still use ant, you can try this instead of your commands ("
ant debug / adb install .apk
")This combines both of your commands and also does a reinstall if the package already exists.
If you use gradle, you can do
(this is from a question about how to do this on gradle. Upvote there too, if you use this)