I'm desperately trying to set-up RenderScript in Android Studio. According to this manual http://developer.android.com/guide/topics/renderscript/compute.html#ide-setup I have set the highest available renderscriptTargetApi 22 and renderscriptSupportModeEnabled true. I use buildToolsVersion "22.0.1". With this I am able to use the ScriptIntrinsic functions - but didn't achieve to compile an self written RenderScript (tried 20h+ now...). I always get the same problem with the R-File (red) - at the latest when I try to rebuild the Project. What am I doing wrong? Thank you very much for your help.
Asked
Active
Viewed 3,372 times
2 Answers
9
- Open Android Studio.
- Select "File/New/New Project..."
- Press Next
- Select "Phone and Tablet" and Minimum SDK: 4.4.
- Press Next.
- Select "Blank Activity".
- Press Next.
- Press Finish.
- Right-click at the top of hierarchy tree on the left ("app").
- Select "New/Folder/RenderScript folder".
- Press Finish.
- Copy a working renderscript file to newly created "rs" folder.
- Double-click on "Gradle Scripts/build.gradle (Module: app).
Insert
renderscriptTargetApi 18 renderscriptSupportModeEnabled true
at the end of defaultConfig section.
- Press Ctrl-F9 to build your project.

Miloslaw Smyk
- 1,305
- 10
- 15
-
In step "12." I used the RS script from here: http://stackoverflow.com/questions/31757109/histogram-matching-in-renderscript/31765342#31765342 – Miloslaw Smyk Aug 05 '15 at 22:40
1
There was a bug related to renderscriptTargetApi 21+
. This has now been fixed in gradle-plugin 2.1.0 and Build-Tools 23.0.3.
Use the code below:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
...
}
The documentation for IDE setup has also been corrected: http://developer.android.com/guide/topics/renderscript/compute.html#ide-setup

Miao Wang
- 1,120
- 9
- 12