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]”
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.