星期四, 1月 09, 2014

RenderScript with AndroidStudio

=== 中文版 ===

我只是想 log 一些用 Android Studio 寫 RenderScript 的 gotcha...

  1. 如果你把 <script-name>.rs 放在跟 .java 同一個目錄,grandle 是不會幫你編的... 你得在跟 src、res 同一層開一個新的資料夾叫「rs」,然後把你的 <script-name>.rs 丟進裡面。
  2. 如果你在執行的時候,出現「Invalid RS info file /data/data/<package>/cache/<package>/<script-name>.o.info! (No such file or directory)」,表示你使用的 build-tool 高過執行環境的 API Level。請改用更低的 build-tool...

    具體作法,是去 build.grandle 裡面,把 buildToolsVersion 改低,例如改成 17...(記得要先去 SDK Manager 裡面裝上更低版本的 build tool。)

=== English Version ===

I just want to log some RenderScript gotcha's while developing with Android Studio.

  1. If you just dropped your <script-name>.rs within the same directory with your .java file, grandle won't compile it for you... You've got to make a new directory aloneside src and res, named "rs", and throw your <script-name>.rs over there.
  2. If you encounter "Invalid RS info file /data/data/<package>/cache/<package>/<script-name>.o.info! (No such file or directory)", that means your build-tool is too new to the environment API level. Switch to a lower version build-tool would make it run.

    In practice, edit build.grandle, switch to a lower "buildToolsVersion", for example 17... (don't forget to install a lower version build-tool with SDK Manager first.)

沒有留言: