开发者

Scala - Android App build fails

I am following the instructions to build Scala app for Android at: scala-to-android

Basically, I installed Scala and changed the ant build.properties to point to Scala and changed build.xml to include build-scala.xml.

ant scala-compile 

is successful, However,

ant debug

generates the following build errors:

scala-compile:

-shrink-if-test:
     [echo] Checking if Scala libraries are installed on emulator or device...
      [adb] BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar

-shrink-config:
  [taskdef] Could not load definitions from resource scala/tools/ant/task.properties. It could not be found.

BUILD FAILED
/home/salil/Programs/androi开发者_如何转开发d-projects/FirstScala/build-scala.xml:82: Problem: failed to create task or type invoked
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

I am a beginner in ant, Android and Scala. Any help would be appreciated. Thanks so much in advance!


I faced the same issue with android dev on Scala. Actually the build script looks for a file named task.properties which is located in scala/tools/ant/task.properties. This is packed inside the jar ant-invoked.jar. I hope you would have downloaded the android-sdk project zip archive from that site. Just copy the folder "configs" from the android-sdk root into your project root folder, this will work. This is were it searches for the file in scala-build.xml

<!-- Project settings -->
property name="configs.dir" value="${basedir}/configs" />
<property name="ant-invoked.jar" value="${configs.dir}/ant/ant-invoked.jar" />

and the target shrink-config

<target name="-shrink-config"
        description="Generate ProGuard configuration file">
    <taskdef resource="scala/tools/ant/task.properties"
             classpath="${ant-invoked.jar}" />


Currently, the most stable way to use Scala with android is to use the Simple Build Tool (SBT) and the Android Plugin

It basically "just works", handling all the steps for you and shrinking with Proguard.


Hi I have a blog here that documents steps to make scala work on android. It makes use of android ant process and sticks close to the android way. You can see the tutorial here http://saadstechblog.blogspot.com/2011/09/scandroid-scala-android-tutorial.html. There is also a github project with all the configuration.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜