1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    177
    Vote Rating
    9
    huberte will become famous soon enough

      0  

    Default Debug an app with weinre

    Debug an app with weinre


    Finally,

    it's almost there !

    I used weinre to debug my app on my android phone : no pb with the web app

    But if I packqge build with sencha cmd, app is not launching, weinre is not seeing the target.

    I see that the script src with the weinre is still there in my apk, in index.html !
    (Uh ? why is there an index.html in my apk, with development.js in it ? It should be production.js or something like that, right ?)

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Are you using an IP to the weinre server and the server is listening on that IP?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    177
    Vote Rating
    9
    huberte will become famous soon enough

      0  

    Default


    Yep ! It works with the app on localhost running on the emulator

    I see the weinre client on my weinre server

    It's not working with the app builded

    EDIt; I'll be more specific, same happends with emulator or my smartphone : I can see my app when launching chrome on android : I can see the client connected on weinre. I can't see my app when launched as an apk : just the 3 dots blinking ; I can't see it in weinre.

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    177
    Vote Rating
    9
    huberte will become famous soon enough

      0  

    Default


    Sorry to ask again, but did someone succeed in debugging an apk (packed with sencha CMD) with weinre ?

    I switch back to the test app "Welcome to sencha touch 2", even with this code, I see my client when launching the app via emulator's browser, not when launching the app in apk (which is hanging on the white dots)

    Here the only thing I add to the code in index.html : the line 52 (and again, why is there development.js in my apk ? why is is not production.js ? or something else ?)

    Code:
            @-webkit-keyframes appLoadingIndicator{            0% {
                    opacity: 0.8
                }
                50% {
                    opacity: 0
                }
                100% {
                    opacity: 0.8
                }
            }
        </style>
        <script src="http://192.168.0.10:8080/target/target-script-min.js#anonymous"></script>
        <!-- The line below must be kept intact for Sencha Command to build your application -->
        <script id="microloader" type="text/javascript" src="touch/microloader/development.js"></script>
    </head>
    EDIT :

    The only thing shown in the console when using chrome on my smartphone is this :

    Code:
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.component' of: 'Ext.dataview.DataView' with: 'Ext.Component'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.mask' of: 'Ext.LoadMask' with: 'Ext.Mask'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.container' of: 'Ext.dataview.DataView' with: 'Ext.Container'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.viewport' of: 'Ext.viewport.Android' with: 'Ext.viewport.Default'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.component' of: 'Ext.dataview.DataView' with: 'Ext.Component'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.mask' of: 'Ext.LoadMask' with: 'Ext.Mask'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.container' of: 'Ext.dataview.DataView' with: 'Ext.Container'. Be sure it's intentional.
    [INFO] [Ext.ClassManager] Overriding existing alias: 'widget.viewport' of: 'Ext.viewport.Android' with: 'Ext.viewport.Default'. Be sure it's intentional.
    When packed, the app wont launch, weinre shows nothing

  5. #5
    Sencha User debianw's Avatar
    Join Date
    Mar 2012
    Location
    Costa Rica
    Posts
    49
    Vote Rating
    2
    debianw is on a distinguished road

      0  

    Default


    Try to add the script inside the app.json.

    What I've been doing inside my app is adding a way to turn on/off the remote debugging. Example I have a togglefield in my configuration screen and I am listening the dragend event of that field and in my controller I load the script at runtime.

    Code:
    var bodyEl          = document.getElementsByTagName('body')[0],
          scriptDebugJS;
    
    
    // create script element
    scriptDebugJS         = document.createElement('script');
    scriptDebugJS.type = "text/javascript";
    scriptDebugJS.src   = "http://ip_address_of_server:3000/target/target-script-min.js#anonymous";
    scriptDebugJS.id     = "scriptDebugJS";
    
    
    bodyEl.appendChild(scriptDebugJS);
    I don't have any problem with that for now.


    I'm still looking a way to turn off the debugger. Removing the script at runtime does not stop the connection to the weinre server.

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    177
    Vote Rating
    9
    huberte will become famous soon enough

      0  

    Default


    Could you tell me how do I add an easy line for weinre in app.json please ?

  7. #7
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,347
    Vote Rating
    846
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    For development you can add the url as an entry in the js array. When you build this will try to copy the file depending on which version you are using. You may just have to edit the index.html in that case.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  8. #8
    Sencha User
    Join Date
    Jul 2012
    Posts
    177
    Vote Rating
    9
    huberte will become famous soon enough

      0  

    Default


    Did you read the thread ? I wrote about the fact that weinre does no see the client in apk, when added to index.html.

    http://www.sencha.com/forum/showthre...l=1#post903633

    SO could you be more specific and tell me exactly where to put
    Code:
    http://192.168.0.10:8080/target/target-script-min.js#anonymous
    You can sse this other thread too : http://www.sencha.com/forum/showthre...764#post912764

  9. #9
    Sencha User
    Join Date
    Jul 2013
    Posts
    4
    Vote Rating
    0
    DragonSL is on a distinguished road

      0  

    Default


    in app.json file put this
    "js": [
    ...
    ...
    ...
    ,
    {
    "path": "http://192.168.0.2:8080/target/target-script-min.js#anonymous",
    "remote": true
    }
    ]

    where 192.168.0.2 -- your weinre server host ip

  10. #10
    Sencha User
    Join Date
    Jun 2014
    Posts
    8
    Vote Rating
    0
    votech123 is on a distinguished road

      0  

    Default debuggin with weinre

    debuggin with weinre


    Anything I put into directly into app.json gets overwritten during build in Sencha architect