Tream
Tream

Reputation: 1054

Correct paths for sencha Touch 2 + PhoneGap

I want to create a mobile-App with sencha Touch 2 + Phonegap.

I found out, that I have to use *file:///android_asset/www/* for paths.

/assets/www/index.html

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>

    <link rel="stylesheet" href="file:///android_asset/www/app/app.css" type="text/css">

    <script type="text/javascript" src="file:///android_asset/www/sdk/sencha-touch.js"></script>
    <script type="text/javascript" src="file:///android_asset/www/all-classes.js"></script>
    <script type="text/javascript" src="file:///android_asset/www/app.js"></script>
</head>
<body>T5</body>
</html>

After running the app, I got errors like: Uncaught Error: [Ext.Loader] Failed loading 'app/view/home/main.js', please verify that the file exists at file:///android_asset/www/sdk/sencha-touch.js:7914

So I added "file:///assets/www/", but I still get: Uncaught Error: [Ext.Loader] Failed loading 'file:///assets/www/app/view/home/main.js', please verify that the file exists at file:///android_asset/www/sdk/sencha-touch.js:7914

Something is wrong with the paths. How should the path look like?

Upvotes: 2

Views: 606

Answers (1)

kevinstueber
kevinstueber

Reputation: 2956

You're basically running a website within a webview, so they are all relative to your index.html file, so you should be able to define your paths as follows:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>

    <link rel="stylesheet" href="app/app.css" type="text/css">

    <script type="text/javascript" src="sdk/sencha-touch.js"></script>
    <script type="text/javascript" src="all-classes.js"></script>
    <script type="text/javascript" src="app.js"></script>
</head>
<body>T5</body>
</html>

Upvotes: 1

Related Questions