Hybrid View

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1463 in a recent build.
  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    52
    Vote Rating
    1
    testvogel is on a distinguished road

      1  

    Default Sencha Touch 2 + PhoneGap are not working on Android 4

    Sencha Touch 2 + PhoneGap are not working on Android 4


    Hi,

    my app is properly working on Android 2.3.x but not on Android 4. The problem is that every controller throws an

    Unknown chromium error: -6

    and I dont why this happens and how I can figure out what exactly it is.

    Here you can see how Im starting my app and controllers:

    Code:
    function mainLaunch(){
        console.log("mainLaunch");
        Ext.Loader.setConfig({ enabled: true });
    
        Ext.application({
            name: 'MyApp',  
            appFolder: 'app',
            models: ['Customer'],
            controllers: ['MainController','ProfileController']    ,
            launch: function() {
                console.log('launch:');
    
            }
        });
    }
    I see the "mainLaunch" output but never see the "launch" output. If I delete the controllers the app launches properly (I see the "launch" output). However, I'm confused why this is working on every 2.x Android device but not on Android 4 (emulator as well as real device).

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,548
    Vote Rating
    873
    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 the files loading?
    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
    Nov 2011
    Posts
    52
    Vote Rating
    1
    testvogel is on a distinguished road

      0  

    Default


    Tell me how I can debug this?

    You can easily reproduce this issue by using any sencha example (I have it tested with the kiva example) and phonegap 1.2

    Create a new Android project and try to start the sencha example in any webview:

    Code:
    import com.phonegap.DroidGap;
    
    import android.os.Bundle;
    
    public class EasyPaymentAppActivity extends DroidGap {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            super.loadUrl("file:///android_asset/www/index.html");
        }
    }

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    52
    Vote Rating
    1
    testvogel is on a distinguished road

      0  

    Default


    any ideas or hints? Is this a sencha touch or phonegap issue?

    ok... The problem is that the controller files cannot be found but I dont know why, because on android 2.3 they will be found

    log output:

    Code:
    12-19 09:10:37.787: D/PhoneGapLog(1503): Uncaught Error: [Ext.Loader] Failed loading 'app/controller/MainController.js', please verify that the file exists
    12-19 09:10:37.787: D/PhoneGapLog(1503): file:///android_asset/www/lib/js/sencha-touch-all-debug-w-comments.js: Line 7785 : Uncaught Error: [Ext.Loader] Failed loading 'app/controller/MainController.js', please verify that the file exists
    12-19 09:10:37.787: E/Web Console(1503): Uncaught Error: [Ext.Loader] Failed loading 'app/controller/MainController.js', please verify that the file exists at file:///android_asset/www/lib/js/sencha-touch-all-debug-w-comments.js:7785

  5. #5
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Sounds like a PhoneGap/Android issue. The files probably are not dynamically loading correctly (no permission, looking in the wrong place).

    To rectify this, you could use our tools to build your application (which is what you should do in production anyway).

    http://robertdougan.com/posts/packag...ncha-sdk-tools
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  6. #6
    Sencha User
    Join Date
    Nov 2011
    Posts
    52
    Vote Rating
    1
    testvogel is on a distinguished road

      0  

    Default


    My application needs some device capabilities like nfc and camera, so i have to use phonegap :/

  7. #7
    Sencha User
    Join Date
    Jan 2011
    Location
    Colorado
    Posts
    6
    Vote Rating
    2
    southplatte is on a distinguished road

      2  

    Default


    Quote Originally Posted by rdougan View Post
    Sounds like a PhoneGap/Android issue. The files probably are not dynamically loading correctly (no permission, looking in the wrong place).

    To rectify this, you could use our tools to build your application (which is what you should do in production anyway).

    http://robertdougan.com/posts/packag...ncha-sdk-tools
    UPDATE: After investigating, the Sencha Build does help. I needed to use the /builds/sencha-touch-all-debug.js to run the builder properly, as I guess the errors were being caused by items that are not in the "core" files and are only in the "all" files as defined http://docs.sencha.com/touch/2-0/#!/guide/building here. So now, I have been able to use sencha-touch.js, all-classes.js and my standard app.js files without issue.

    Sorry to trouble you all.


    -->
    Unfortunately, after following your suggestion and running the Sencha Builder, my particular app still displays the same issues on Android 3.2 and Android 4.0.3. On 3.2 it cannot load /lib/touch/src/event/Dispatcher.js, /lib/touch/src/MessageBox.js, or /lib/touch/src/event/publisher/Dom.js. I am not experiencing any errors related to my custom classes, whether they are views, models, stores or controllers, but only with the primary SRC folder items.

    The only work around I have found on this platform is to use the touch/builds/sencha-touch-all.js that comes with the ST2 download, and add all the class files for the models, views, stores and controllers in the <head> as a <script> element, as using the sencha-all.js then causes issues with the user defined class files, which is the same error when using the Sencha Builder to build the app-all.js file and using it in place of all the other files.

    I have experimented with various Ext.requires and nothing has worked outside of using the sencha-all.js and including the class files.

    On 3.2 it throws file not found/loaded error to make sure it exists and on 4.0.3 it throws chromium error: -6.

    On android 2.2 and 2.3 it works flawlessly either way - using the builder and including only a single app-all.js or not using it and including the files - and it does not seem to matter if I use the sencha-touch-debug.js or the sencha-touch-all-debug.js file in the builds directory on 2.2/2.3 devices.

    I should also note that I am packaging with PhoneGap 1.4.1. Using this, when the item was loaded onto a 2.2/2.3 device/VM it worked flawless. However, on 3.2 all of the ajax calls to the "local" /app/data/test.json file failed and ended with a blank screen. It should be further noted, that altering the ajax calls to place a call to the same exact file located on a public server (http://myserver.com/test.json) work without issue.

    So it seems that the PhoneGap wrapper might be playing around with the way files may be loading once PhoneGap is included - as no matter what device was used, they could all display the app straight away via browser.
    Last edited by southplatte; 20 Feb 2012 at 9:29 PM. Reason: user error, not related to bug.