These scripts are modified from Exploring Android to support android sdk tools r14
-
Create an android project either by using eclipse adt plugin or android create command
-
Checkout
ant-android-scala
to your local disk,/opt/ant-android-scala
for example -
Copy
local.properties
in ant-android-scala to the project directory you just created in step 1, and change the configurations to fix your environment -
Edit
build.xml
(use android update command to generate ant build files if the project is created by eclipse), add<import file="${ant.android.scala.dir}/build-scala.xml"/> <!-- Converts this project's .class files into .dex files --> <target name="-dex" depends="-compile, scala-compile, scala-shrink"> <do-only-if-not-library elseText="Library project: do not dex..." > <scala-dex-helper /> </do-only-if-not-library> </target>
under
<import file="${sdk.dir}/tools/ant/build.xml" />
-
Now you can add some scala source code and use ant command to build the project
Set scala.library.installed=true
in local.properties
, the building script will skip proguard when you run ant debug
or ant debug install
, don't forget to add
<uses-library android:name="scala_actors-2.9.1"/>
<uses-library android:name="scala_collection-2.9.1"/>
<uses-library android:name="scala_immutable-2.9.1"/>
<uses-library android:name="scala_library-2.9.1"/>
<uses-library android:name="scala_mutable-2.9.1"/>
to the application element in you AndroidManifest.xml