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

Wont find R.Id. in fragment
Decode large base64 string
I am trying to create an app in android to insert data into sql server through a web service.
EditText: how to underline all Text in an editText
Android streaming screen [closed]
Google Maps Android API v2 tutorial
how to grab referrer/campaign source from google analytics
MediaPlayer does not play when activity started with AlarmManager
Android Eclipse compilator bug? java.lang.NoClassDefFoundError: org.apache.commons.net.ftp.FTPClient [duplicate]
Reading File from Internal storage with No Read/Write Permissions?
Get object File from a file in raw folder
Action Bar - items with text at bottom of the icon
Update alpha of a image inside ListView
(Android) Dispatch “ENTER” key event to EditText
What does -webkit-text-size-adjust do? [closed]
How to toggle Airplane Mode on Android 4.2 using root?

Categories

HOME
c99
oracle-apex-5
can
edge
soa
web-hosting
title
google-chrome-app
pega
opengl-es-3.0
asp.net-mvc-viewmodel
google-container-registry
cfml
connector
gmm
swagger-2.0
boost-icl
joptionpane
resourcebundle
delimiter
apktool
ceylon
xbox
powershell-ise
turfjs
linkedhashmap
twos-complement
hibernate-search
yowsup
git-rewrite-history
ogc
android-softkeyboard
serde
yii2-user
edit
check-mk
quicktime
slackware
flex-monkey
xcode-server
riot
nss
hadoop-partitioning
invoke-sqlcmd
spring-retry
tfs-workitem
morton-number
android-launcher
opserver
linked-tables
mirror
nutiteq
telepat
typeconverter
teamcity-9.1
entity-framework-4.3
zend-currency
diff3
execve
webmatrix-3
filesplitting
teaspoon
formview
jama
dct
windows-phone-8-sdk
cnf
actiondispatch
swfobject
asplinkbutton
panda3d
monotouch.dialog
veracity
wcf-configuration
dajaxice
fusefabric
google-maps-mobile
u2netdk
update-statement
google-ajax-api
massive
inline-formset
timertask
cruisecontrol.rb
non-clustered-index
openfaces
nstokenfield
request-headers
filesystemobject
tui
google-wave
windows-identity
soappy
ifilter
wcf-proxy

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