如何在Ubuntu下安装android sdk

 近日学习Google android手机平台开发,在ubuntu下配置了半天没有成功,最终发现还是Java 虚拟机 环境的问题,具体的方法参见:http://www.apreche.net/how-to-setup-android-sdk-in-ubuntu/

How To Setup Android SDK in Ubuntu


If you pay attention to technology at all, you probably know about Google’s Android platform. People have largely panned it because they were expecting a gPhone to do battle with the iPhone. I think they are missing the point. This is the first time ever where there is a well documented and supported open source mobile platform. I joined the Android developer’s mailing list last night, and I’ve already gotten almost 200 messages on it. Whether or not people are excited, developers are excited about developing mobile applications for this new platform. Some of that excitement might have to do with the cash prizes, but I doubt that’s the only factor.

Anyway, one of my major disappointments with the iPhone is the lack of podcatching software. If it had a podcatcher, I probably would have bought one right off the bat. Android has presented me with the opportunity to write my own mobile podcatching software. I’ve decided that I’m going to go for it. Being an Ubuntu user, I had to setup the SDK to get working. However, I ran into a few problems along the way. Since I suspect many other Ubuntu users out there also might want to get into the Android developing business, here I will post how I got the development environment setup in Ubuntu.

The first thing you need is a computer with Ubuntu 7.10 Gutsy Gibbon installed. The computer should be connected to the Internet. Ubuntu by default tries to use open source versions of Java, and while these are pretty good, they will not work for android development. The fact that Ubuntu will not default to using Sun Java, even after you install it explicitly, is the primary reason this how to is necessary. Anyway, the first step is to update your packages and install Eclipse and Sun Java.

sudo aptitude update
sudo aptitude install eclipse sun-java6-jdk

If you want to use Sun Java as the default JVM in your web browsers, run this command as well.

sudo aptitude install sun-java6-plugin

Now you need to make Sun Java the default jvm in Ubuntu. You can do that with this command.

sudo update-java-alternatives -s java-6-sun

We also need to edit the file /etc/jvm. Edit that file as root with your favorite text editor.

sudo gedit /etc/jvm

The contents of the file will look something like this.

/usr/lib/jvm/java-gcj
/usr/lib/jvm/ia32-java-1.5.0-sun
/usr/lib/jvm/java-1.5.0-sun
/usr

Change it to look like this, then save and quit your text editor.

/usr/lib/jvm/java-6-sun
/usr/lib/jvm/java-gcj
/usr/lib/jvm/ia32-java-1.5.0-sun
/usr/lib/jvm/java-1.5.0-sun
/usr

When certain programs on your system want to run java, they will look at this file to figure out which JVM to use. They will try every JVM in the list starting with the one on top until one of them works. Eclipse, however, does not use this file. It has its own file that works in the same way. First edit the eclipse java_home file as root.

sudo vim /etc/eclipse/java_home

There should already be a line in that file for Sun Java 6. Move this line to the top of the file. Add it to the top if it isn’t there.

/usr/lib/jvm/java-6-sun

Now your Ubuntu system is ready to run the Android development kit. Go to the Android documentation site and follow the directions there. Have fun making mobile apps in Java!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值