Billy Mayes
Billy Mayes

Reputation: 315

Problems running Sencha Touch / PhoneGap example code on android

Hi guys I'm running through this tutorial:

http://www.sencha.com/learn/a-sencha-touch-mvc-application-with-phonegap

and trying to get the code running on Android. I'm set up with Eclipse and targeting Android 2.3.3

I've downloaded the final code from Git but I keep getting the error (in LogCat):

02-01 14:59:08.709: E/Web Console(16659): Uncaught ReferenceError: device is not defined at file:///android_asset/www/app/app.js:8

The code in question is:

Ext.regApplication({
    name: 'app',
    launch: function() {
        this.launched = true;
        this.mainLaunch();
    },
    mainLaunch: function() {
        if (!device || !this.launched) {return;}
        this.views.viewport = new this.views.Viewport();
    }
});

I get the same error whether running on the emulator or a physical device. I've got Weinre set up but it didn't give me any useful information, only stating "error occured: [unknown filename]:[unknown lineno]: [unknown message]"

Upvotes: 0

Views: 3508

Answers (3)

Rob
Rob

Reputation: 31

I am having a similar issue but it only occurs when including the JS file for weinre to work. If you remove that on my setup it loads the application fine. Not sure why and currently on the hunt to get it fixed as need weinre to help with debugging of course!

Upvotes: 0

Johnny
Johnny

Reputation: 7321

Same thing happened to me. Add <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission> to AndroidManifest.xml and it should go away.

Upvotes: 0

Simon MacDonald
Simon MacDonald

Reputation: 23273

I'm pretty sure that "app" is conflicting with the App class in PhoneGap which is accessible at navigator.app. Try changing the name to "myapp" and see if it fixes your problem.

Upvotes: 1

Related Questions