How to solve Android Phonegap app SyntaxError: Parse error? (Blank Screen issue)

后端 未结 1 965
暖寄归人
暖寄归人 2021-01-24 06:53

I\'m using weinre to be able to make remote debug on an app being executed on an android emulator, running on Mac OS X (latest version).

Context

相关标签:
1条回答
  • 2021-01-24 07:39

    You will first need to address this point in the DOJO FAQ:

    I can’t seem to run Dojo Mobile pages on Android devices when using libraries like PhoneGap, what am I doing wrong?

    There is a known bug in the Android WebKit browser implementation that does not allow files starting with an underscore ‘_’ character to be loaded from local file system (for example, when using Dojo Mobile in conjunction with PhoneGap to create a native app). The way around this problem is to create a built version of your files (you’ll want to do this anyway for performance).

    FAQ: http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/faq.html

    Confirmation of this problem:

    http://developer.appcelerator.com/question/144171/using-dojo-mobile-and-filenames-with-

    Follow this build tutorial to create single javascript file build of your DOJO app which will do away with the individual javascript files that start with underscores:

    http://dojotoolkit.org/documentation/tutorials/1.9/build/

    Assuming you can build DOJO app ok then you need to follow this for integrating with Phonegap/Cordova:

    https://dojotoolkit.org/documentation/tutorials/1.9/dojox_app/contactsCordova/

    *If you have a problem using deviceTheme.js, notice in the middle of the page how it shows what your Phonegap/Cordova index.html file should look like:

    // Your device Theme
    <script src="{path_to_dojox}/dojox/mobile/deviceTheme.js"></script>
    
    // Loads cordova
    <script src="cordova.js"></script>
    
    // Loads DOJO
    <script src="{path_to_dojo}/dojo/dojo.js" data-dojo-config="app: {debugApp: 1}, async: true"></script>
    
    // DOJO then uses this require statement to load your built DOJO app
    <script>
        require(["contactsApp/contacts"]);
    </script>
    

    Original thoughts helping @nffdiogosilva work through this before we took it offline:

    This is mostly a debugging issue where you need to isolate the moving parts and verify your assumptions step by step. Ensure that nothing more basic that you are assuming works is not actually broken. Perhaps the dojo.js library or the initial instantiation of you dojo app object? Also, are you using any other javascript libraries?

    In our other thread I mentioned how I used Weinre to figure out that my Sencha app object wouldn't load on Android 2.3. The Sencha library itself seemed to load ok but the boilerplate call to create my Sencha app object would hang for a bit and then not load and my UI didn't render at all (white screen!). I figured this out by doing some incremental console.log traces as well as commenting out some of my different javascript includes until the problem became clear. It worked fine on Android 4+ though so maybe it is a different problem in this case.

    0 讨论(0)
提交回复
热议问题