I want to develop a game like jigsaw where the player will attach pieces of puzzle to match to a sprite.For this I've figured out to do Masking. I even found one class in cocos2d for iphone named CCMask that does this task pretty well. However when I try to port this to the java code for use with cocos2d-android I get Null pointer exception at CCRenderTexture. The class that I am trying to port is here.
Somewhere I read that if I do CCRenderTexture under the layer's onEnter callback the code will not crash and it doesn't crash when I do it like that. But then I don't get any masked sprite either as I have to add the CCMask class as a child to a layer to call the onEnter method.
Can anybody help me with the proper flow of the code or by confirming that it really works for cocos2d-android? This is the link for the library that I am using.