kikoso / android-stackblur

Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.
Apache License 2.0
3.59k stars 648 forks source link

R Class problem after Reference Library #23

Closed david99999 closed 3 years ago

david99999 commented 10 years ago

Hello, I´m getting a rare error in runtime, I´ve compiled the NDK successfully and the StackBlur (library project) compiles well, but when I reference the project library in a totally new Android Application Project something is interfering with the R Class of the new project, it compiles well but when call findviewById(R.id.textView1) returns null, I've tested the Android Project before reference the library and without it findviewById(R.id.textView1) works normally.

I´ve looking around and the people getting this error agree it is something weird with the R Class, but nobody found a really stright solution.

Can you help me with this error, please?

I really want to try this awesome blur effect with the ndk implementation.

kikoso commented 10 years ago

Hello @david99999

R.id.textView1 looks like a TextView. A TextView it is on the main project, not on the library. If you are trying to reference R.id.textView1 maybe you should check if your project contains such view? Because the library does not :-).

Regards

david99999 commented 10 years ago

Hi, I'm talking about the views in my Android Aplication project, not in the library, I've checked the views that the activity contains,(StackBlurDemo project has the same R weird error), and found that the views in fact are there, but with a different ID:

R.id.textView1 in R class has id = 0x07090009

but after referenced StackBlur Libraryin runtime has changed the ID

R.id.textView1 in R class at runtime has id = 0x070A0009

The ID has increased in a 0x10000 value, I've tried using

findviewbyid(R.id.textView1 + 0x10000) and it works!! (Doesn't return null)

I don't understand why reference a library can change the id of a view in runtime, I think its a problem with a RenderScript and the Eclipse compiler

Finally to get working your library in my demo project, had to remove the RenderScript code (the .rs file, remove the render lines in project.properties and the ones in .java too) and now I can see how fast is the natively process!

dingbuoyi commented 10 years ago

david99999 is right! but why!!!! I dont understand!!!what cause findViewById return null

swapps commented 10 years ago

i have the same problem, as soon as i had the library i can't run my app anymore because of findviewbyid error

takafu commented 10 years ago

I'm having the same problem.

Aneemz commented 10 years ago

david99999 is correct.

It's definitely something to do with the renderscript.

romantic011 commented 10 years ago

I' having the same problem,why?What causes this problem?

mozikun commented 8 years ago

I meet the same problem!david99999 is right! @david99999 which file and codes should be remove?

mozikun commented 8 years ago

I try delete rs file and RSBlurProcess.java, and delete reference java code. It works used by Java and Native called.