1

We have an Android app that uses some renderscript code. We are moving it to a library that we have. I copied all classes that call scripts and also copied the scripts to the src/main/rs folder. The project has the following structure: - a com.android.application module - a com.android.library module (where the render scripts are located)

The library calls the renderscripts from java code correctly (same as the other pure Android application project did) but they are not found.

When I try to look for them (ctrl+N), they were generated but are located inside a different folder build/generated/source/rs/release/com/package/name . In the android application we have, they are generated to the debug folder, and I think this should be the case here to work correctly too (debug mode run).

What should I do to make it work? Thanks.

Lxu
  • 437
  • 1
  • 5
  • 12

1 Answers1

0

I don't think that RenderScript is supported as part of a library in Android Studio. It has to be part of the main application package instead (at least based on my experience).

Stephen Hines
  • 2,612
  • 1
  • 13
  • 12
  • If this is true, could it be adapted to work? Maybe there is some steps that I could know and reproduce to make it happen. – Lxu Jan 07 '16 at 18:06
  • No, the generated files need to have the regular package name embedded within them, so they won't work for libraries. I don't think this is something that is very high priority for the RS team to fix either, since bundling with the regular application is more common in general. – Stephen Hines Jan 07 '16 at 19:27
  • I was able to make it work. I tried to manually copy the generated classes into my project, but when compiling it was saying they already existed. By Default library modules generate a release build to link with other modules, this is why they were being generated inside the release folder. However, for some reason, the IDE was not being able to link them or tell me how to import them correctly (but the java classes were there), so I added a import com.my.package.* where I need them, and it worked. – Lxu Jan 15 '16 at 09:42