简体   繁体   中英

Renderscript not working for Adt bundle

I'm using the Android ADT bundle on Ubuntu 12.04 and I'm trying to write an app that uses RenderScript.

I've placed a .rs file in the package folder and it looks as follows:

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

void root(const uchar4 *in, uchar4 *out, uint32_t x, uint32_t y){

    out->r = rsRand(255); 
    out->g = rsRand(255); 
    out->b = rsRand(255); 

}

However I'm getting the following errors:

error: Compute kernel root() targeting SDK levels 11-13 may not skip (on line 4)
error: missing "#pragma rs java_package_name(com.foo.bar)" in source file (on line 10)
error: missing pragma for version in source file (on line 10)

Can anybody please help me figure out this problem?

I had the same problem when trying to build the HelloCompute renderscript example. I use Eclipse, and after examining the error messages in the Problems window, I noted that they dealt with version numbers. So I changed the version numbers in the project.properties file as follows:

target=android-20
renderscript.target=20
renderscript.support.mode=true
sdk.buildtools=20

After this, the pragma errors went away and the project built successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM