Reputation: 136
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();
}
Upvotes: 0
Views: 585
Reputation: 2113
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.
Upvotes: 0
Reputation: 54
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();
Upvotes: 1
Reputation: 13723
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>
Upvotes: 1