1、下载安装 Eclipse Classic 3.7.2
注:下载JDK与Android SDK的事我就不详述了,有问题可以问我
2、安装Android ADT Plugin
安装地址:https://dl-ssl.google.com/android/eclipse/
3、安装Scala IDE
安装地址:http://download.scala-ide.org/releases-29/milestone/site/
4、安装AndroidProguardScala
安装地址:https://androidproguardscala.s3.amazonaws.com/UpdateSiteForAndroidProguardScala
5、创建Android Project
6、Add Scala Nature
在android项目上点右键,Configure->Add Scala Nature
7、Add AndroidProguardScala Nature
在android项目上点右键,Add AndroidProguardScala Nature
8、调整Java Build Path顺序(重要)
注意把两个scala的lib,移动到Android上方
![](http://static.oschina.net/uploads/space/2012/0608/011941_fF58_569848.png)
9、把Java的Activity类替换为scala的Activity类
package org.noahx.scalaandroid
import android.app.Activity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
import android.view.View
class ScalaAndroidActivity extends Activity {
override protected def onCreate(savedInstanceState: Bundle) = {
super.onCreate(savedInstanceState)
setContentView(R.layout.main)
val text = findViewById(R.id.text1).asInstanceOf[TextView]
val button = findViewById(R.id.button1).asInstanceOf[Button]
button.setOnClickListener(new View.OnClickListener() {
def onClick(v: View) = {
text.setText("hello scala!!!")
}
})
}
}
注:修改完layout,把project clean一下
10、运行效果
![](http://static.oschina.net/uploads/space/2012/0608/014951_Jc4b_569848.png)
![](http://static.oschina.net/uploads/space/2012/0608/101032_ru2S_569848.png)
![](http://static.oschina.net/uploads/space/2012/0608/110310_T9HF_569848.png)