changing ExampleProxy name to TestProxy

You must Login before you can answer or comment on any questions.

I'm trying to create a module in Android. The sample module works. However, if I try to change the name of the proxy I get an error:

Uncaught TypeError: Object [object Object] has no method 'createTest'.

I change every occurance of "Example" in the file to "Test".

Javascript is still able to call the old module. If I look in the build/classes directory of the module, I see that ExampleProxy.class is still being created.

It looks like some way of cleaning should be made. Could anyone help?

Thanks!

— asked 8 months ago by Yoav R
0 Comments

3 Answers

Yes, you can do a Project > Clean in Ti Studio. This will force a complete rebuild the next time you try to run or debug the app.

If you still have trouble, you may want to post your module code.

Steps to reproduce behevior:

  1. create a new module, name it "testmodule1", set the module id to "test.testmodule1".
  2. correct build.properties so that the NDK path will be correct.
  3. press the right button on build.xml then select Run as -> ant build.
  4. copy the zip file from dist to the root of your project.
  5. add the following to tiapp.xml: <module version="0.1" platform="android">com.amudanan.testmodule3</module>
  6. put the following in app.js:

    var testmodule = require('test.testmodule1');
    
    var test = testmodule.createExample({
        message: &quot;Creating an example Proxy&quot;,
        backgroundColor: &quot;red&quot;,
        width: 100,
        height: 100,
        top: 100,
        left: 150
    });
    
    var win = Ti.UI.createWindow({
        backgroundColor:'#ffffff',
        navBarHidden:true,
        exitOnClose:true
    });
    
    win.add(test);
    win.open();
    
  7. install to android device.

  8. go back to the module project, change "ExampleProxy.java" to "TestProxy.java"
  9. recompile
  10. change "var test = testmodule.createExample" to "var test = testmodule.createTest"
  11. Copy to application's root directory, install to device.
  12. the error displayed is: Location: [25,24] app.js Message: "Uncaught TypeError: Object #<Testmodule1> has no method 'createTest'. Source: var test=testmodule.createTest({
— answered 8 months ago by Yoav R
answer permalink
1 Comment
  • Apologies -- I didn't realize you were talking about a native module.

    — commented 8 months ago by Jason Priebe

Hi Yoav,ok i think i got your problem, Go back to your module project and change "ExampleProxy.java" to "TestProxy.java".

Then

1: change the class name also to TestProxy which extents krollProxy.

2: change the constructor name accordingly, that is required for object creation.

Done

try this and let me know, whether it worked or not.

— answered 8 months ago by Ashish Nigam
answer permalink
1 Comment
  • Hi Ashish,

    the following line was automatically changed when I did the procedure above:

    public class TestProxy extends TiViewProxy

    As you see, it extends TiViewProxy, not krollProxy.

    So the error still exists.

    -Yoav.

    — commented 8 months ago by Yoav R

Your Answer

Think you can help? Login to answer this question!