Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试在android emulator上运行Tianium应用程序时出错_Android_Iphone_Titanium - Fatal编程技术网

尝试在android emulator上运行Tianium应用程序时出错

尝试在android emulator上运行Tianium应用程序时出错,android,iphone,titanium,Android,Iphone,Titanium,我在titanium studio中构建了一个应用程序,并在iphone模拟器和iphone设备上运行了它,它运行得非常完美。但当我试图在android emulator或android设备上运行它时,它崩溃了 我得到以下错误: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.smartcrew/org.appcelerator.titanium.TiActivity}: java.lang.Illeg

我在titanium studio中构建了一个应用程序,并在iphone模拟器和iphone设备上运行了它,它运行得非常完美。但当我试图在android emulator或android设备上运行它时,它崩溃了

我得到以下错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.smartcrew/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: call to getView on a Window
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
at android.widget.TabHost.setCurrentTab(TabHost.java:323)
at android.widget.TabHost.addTab(TabHost.java:213)
at ti.modules.titanium.ui.widget.TiUITabGroup.addTab(TiUITabGroup.java:69)
at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:192)
at ti.modules.titanium.ui.TabGroupProxy.handlePostOpen(TabGroupProxy.java:275)
at ti.modules.titanium.ui.TabGroupProxy.handleMessage(TabGroupProxy.java:91)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.IllegalStateException: call to getView on a Window
at ti.modules.titanium.ui.WindowProxy.getView(WindowProxy.java:63)
at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:384)
at ti.modules.titanium.ui.WindowProxy$1.windowCreated(WindowProxy.java:117)
at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31)
at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:271)
at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:298)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

E/AndroidRuntime(  246): FATAL EXCEPTION: main
E/AndroidRuntime(  246): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.smartcrew/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: call to getView on a Window
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:651)
at android.widget.TabHost.setCurrentTab(TabHost.java:323)
at android.widget.TabHost.addTab(TabHost.java:213)
at ti.modules.titanium.ui.widget.TiUITabGroup.addTab(TiUITabGroup.java:69)
at ti.modules.titanium.ui.TabGroupProxy.addTabToGroup(TabGroupProxy.java:192)
at ti.modules.titanium.ui.TabGroupProxy.handlePostOpen(TabGroupProxy.java:275)
at ti.modules.titanium.ui.TabGroupProxy.handleMessage(TabGroupProxy.java:91)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)

Caused by: java.lang.IllegalStateException: call to getView on a Window
at ti.modules.titanium.ui.WindowProxy.getView(WindowProxy.java:63)
at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:384)
at ti.modules.titanium.ui.WindowProxy$1.windowCreated(WindowProxy.java:117)
at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31)
at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:271)
at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:298)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
有人知道怎么回事吗?我会发布一些代码,但是太长了,我不知道是哪个部分导致了这个问题

等待您的回答,谢谢

//设置主UIView的背景色(当主UIView上没有窗口/选项卡组时)
// this sets the background color of the master UIView (when there are no windows/tab groups on it)


//Ti.include('Window1.js');
Titanium.UI.setBackgroundColor('#000');

// create tab group


var placeHolders = [{left:10, top:10, width:20, height:20, bgColor:"#FFF", bgAlpha:0.5, img:""},
                    {left:30, top:20, width:50, height:50, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""},
                    {left:60, top:60, width:20, height:20, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""},
                    {left:100, top:20, width:20, height:20, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""},
                    {left:50, top:100, width:20, height:20, bgColor:Math.random * 0xFFFFFF, bgAlpha:0.5, img:""}
                    ];


var tabGroup = Titanium.UI.createTabGroup();





var parentWindow = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundImage:"assets/background.png",
    backgroundColor:'#fff',
    navBarHidden:true,
    tabBarHidden:true
});
addPlaceHolders();

function addPlaceHolders()
{
    for(i = 0; i < placeHolders.length; i++)
    {
        var placeHolder = placeHolders[i];
        var placeHolderView = Titanium.UI.createView({
            top:placeHolder.top,
            left:placeHolder.left,
            height:placeHolder.height,
            width:placeHolder.width,
            backgroundColor:placeHolder.bgColor,
            opacity:placeHolder.bgAlpha

        });
        placeHolderView.name = i;
        parentWindow.add(placeHolderView);
        placeHolderView.addEventListener("click", onPlaceHolderClick);
    }
}


var main = Titanium.UI.createTab({  
    title:'Tab 1',
    window:parentWindow
});
//  add tabs
tabGroup.addTab(main);  

// open tab group
tabGroup.open();

function onPlaceHolderClick(e)
{
    //tell me wot to do here
    alert("tell me wo to do here");
}
//Ti.include('Window1.js'); 钛.UI.setBackgroundColor('#000'); //创建选项卡组 变量占位符=[{左:10,顶:10,宽:20,高:20,bgColor:#FFF”,bgapha:0.5,img::}, {左:30,上:20,宽:50,高:50,bgColor:Math.random*0xFFFFFF,bgapha:0.5,img:“}, {左:60,上:60,宽:20,高:20,bgColor:Math.random*0xFFFFFF,bgAlpha:0.5,img:“”,}, {左:100,上:20,宽:20,高:20,bgColor:Math.random*0xFFFFFF,bgAlpha:0.5,img:“”,}, {左:50,上:100,宽:20,高:20,bgColor:Math.random*0xFFFFFF,bgapha:0.5,img:“” ]; var tabGroup=tianium.UI.createTabGroup(); var parentWindow=Titanium.UI.createWindow({ 标题:“表1”, 背景图片:“assets/background.png”, 背景颜色:“#fff”, 纳瓦尔:是的, 塔巴:对 }); 添加占位符(); 函数addPlaceHolders() { 对于(i=0;i
好吧,这是我所有的代码,你能告诉我这个应用程序做的真的不多吗?我在屏幕上显示了一些窗口。每个窗口都有不同的背景!所以你能告诉我怎么了吗?看看我的答案,有什么帮助请进一步问我谢谢不要告诉我们,这不起作用。它被安装在设备上,但当我打开它时,我得到了FC!