Renderscript error "cannot find symbol ScriptC" in AndroidStudio

123 views Asked by At

AndroidStudio (AS) fails to find the definition of ScriptC_invert when implementing a Renderscript (in another file invert.rs). It is placed in a directory src/main/rs and this is updated in the gradle (AndroidStudio folder). I am using Android SDK 33 which should still support Renderscripts.

I am sure there are no code-wise issues as I am consistent with several examples online, namely, the invert.rs contains:

// File: invert.rs

#pragma version(1)
#pragma rs java_package_name(com.example.sharp)

and the Java code:

ScriptC_invert invert = new ScriptC_invert(rs);

but I get:

error: cannot find symbol ScriptC_invert invert = new ScriptC_invert(rs);

The build.gradle contains:

renderscriptTargetApi 18
renderscriptSupportModeEnabled true

as well as:

sourceSets {
        main {
            renderscript {
                srcDirs 'src/main/rs'
            }
        }
    }

Anyone managed to get this running on current android/AS versions? Thanks!

1

There are 1 answers

0
Top-Master On

Try without Native build-script, and place the file at:

app/src/main/rs/invert.rs

Finally, try:

import com.example.sharp.ScriptC_invert;