Search code examples
androidrenderscript

Set Up Renderscript In Android Without Support Library


I am new to android render-script . I have read Documentation of render-script . It says that including support library for render-script increases your apk size.

Now I donot want to use support library because my min sdk is 17 . I have created a render-script directory in my '/app/src/main' directory in which I have my '.rs' file but it is not showing in my android view .

Can Anyone Please tell me how to set it up without support library where to include my render-script folder . I have googled but everywhere it is support library which is used


Solution

  • Follow the instructions using RenderScript support lib, and do the following:

    1. in build.gradle (app), change renderscriptTargetApi to 17, your minSdk.
    2. in build.gradle (app), change renderscriptSupportModeEnabled to false
    3. in build.gradle (app), remove the line with renderscript-v8.jar, if there is one.
    4. In your Java files, replace import android.support.v8.renderscript.* with import android.renderscript.*
    5. clean the output dir of your application, and recompile it.

    With the steps above, your app should be able to run with platform RenderScript, without changing any actually code.

    The recommended way to create renderscript folder is "File" -> "New" -> "Folder" -> "RenderScript Folder". And paste your .rs files there.

    Also, as a suggestion, use buildToolsVersion "24.0.2" and above with Android Studio 2.2.3+.