android


Titanium Alloy crash on android, Cannot call method 'open' of undefined


I am getting this error when running this very basic project on Android.
I have both android and iphone as build targets and have tried to clean the project.
Must be something very basic that I am missing but I can't see it
index.xml
<Alloy>
<NavigationWindow id="navWin" platform="ios">
<Window>
<Label id="label">Hello, World</Label>
</Window>
</NavigationWindow>
</Alloy>
index.js
if(OS_IOS){
$.navWin.open();
}else{
$.index.open();
}
The reason you get this error is because you have no object to open on your Android platform.
<Alloy>
<NavigationWindow id="navWin" platform="ios">
<Window>
<Label id="label">Hello, World</Label>
</Window>
</NavigationWindow>
<Window platform="android">
<! - - your content - - >
</Window>
</Alloy>
Reason for crash app in android :- in android navigation window doesn't come so navigation window does not open... then it will be crash...
so, use this code in index.html
<Alloy>
<Window id='index'>
<Label id="label">Hello, World</Label>
</Window>
</Alloy>
and in index.js
$.index.open();
This error simply means, that you have not specified any index element. Insert this into your xml at the same hierarchical level as your iOs component.
<Window id="index" platform="android">
<! - - your content - - >
</Window>
Because you specified your main window to exist in iOs only it can never be called in Android and therefore your alloy on Android has no elements at all unless you implement the suggested code. Your .js file can stay the same since the code snippet includes a window with the proper id you are referencing in your js.

Related Links

Android Studio not recognizing Facebook SDK
getResponseCode weather times out nor reads response
android locationRequest interval not update as required
Use OSM Routing on a Google map
Android is not receiving information sent via UDP
Troubles positioning layouts to tic tac toe app - falling off screen
Cordova sqlite does not create DB on $cordovaSQLite.openDB or window.openDatabase
Android isScreenOn Nullpointerexception
Center components in ConstraintLayout [duplicate]
Firebase Getting Instance of 2 Database [duplicate]
How to get notified when foreground application switches
Call AsyncTask from button click and start another activity populated with listview after doInBackground has completed
Volley ImageLoader reloading loaded images on scroll
How sync TabLayout with ViewPager when using TabItem
Change android status bar notification every day
Moving android-sdk and sdk folders to another drive

Categories

HOME
beautifulsoup
microsoftgraph
twitter-bootstrap-3
pagination
vscode-extensions
pdfbox
3d-reconstruction
retrofit2
x-cart
rtf
radgridview
dynamic-sql
android-7.0-nougat
google-data-studio
lilypond
babel
jquery-ias
postscript
string-concatenation
displaytag
onload
moses
motion-detection
uitapgesturerecognizer
xbox
kodi
r-grid
erb
android-sugarorm
hard-drive
sql-delete
fiware-cygnus
raft
openalpr
git-rewrite-history
protein-database
trigonometry
escpos
sharp-snmp
install.packages
smoothstate.js
avcapturedevice
berkeley-db-je
memory-mapping
strftime
mesosphere
fwrite
xbmc
twilio-click-to-call
manova
magic-draw
context-switch
video-conferencing
mathcad
juice-ui
cudd
xcode-server
iotivity
tinkerpop3
windows-azure-queues
ng-grid
xdoclet
cortex-m
grass
invoke-sqlcmd
custom-errors
intel-c++
ons-api
sapscript
evolus-pencil
apache-commons-daemon
jquery-forms-plugin
zend-currency
angular-gettext
ssis-data-flow
psr-4
paw
mintty
xml-dsig
websphere-esb
artemis
ie8-compatibility-mode
rolify
neos-server
workitem
server-administration
dopostback
panda3d
qtconcurrent
koken
rmdir
metaweblog
objective-j
timertask
blender-2.49
sifr
cuda.net
lemmatization

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App