gpt4 book ai didi

Android应用Force打开后立即关闭

转载 作者:行者123 更新时间:2023-12-03 16:35:23 26 4
gpt4 key购买 nike

每当我通过 Eclipse 运行它时,我的原型(prototype) android 应用程序(我应该提到它是我的第一个)一旦打开就会崩溃。我已经搜索了这个网站和许多其他网站,这个问题似乎很常见,但对我来说却不是这样。我已经检查了 AndroidManifest.xml 文件,并且相当确定它是正确的,但我还是把它附在了这里。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cyphr"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />

<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".NSBHSActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DayActivity"
android:label="@string/app_name">
</activity>
<activity android:name=".WeekActivity"
android:label="@string/app_name">
</activity>

</application>

据我所知,这是从程序开始到死亡的 logcat 消息。
08-09 18:23:57.342: INFO/dalvikvm(24229): Debugger has detached; object registry had 1 entries08-09 18:23:57.358: ERROR/AndroidRuntime(24229): ERROR: thread attach failed08-09 18:23:57.756: INFO/ActivityManager(1194): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.cyphr/.NSBHSActivity }08-09 18:23:57.795: INFO/dalvikvm(24239): Debugger has detached; object registry had 1 entries08-09 18:23:57.819: ERROR/AndroidRuntime(24239): ERROR: thread attach failed08-09 18:23:57.897: INFO/ActivityManager(1194): Start proc com.cyphr for activity com.cyphr/.NSBHSActivity: pid=24246 uid=10103 gids={}08-09 18:23:57.959: INFO/foo(1194): ********************** resuming: 114334808008-09 18:23:58.155: ERROR/dalvikvm(24246): Stack overflow on calling method:08-09 18:23:58.155: ERROR/dalvikvm(24246):       android.content.res.AssetManager.loadResourceValue()08-09 18:23:58.155: ERROR/dalvikvm(24246):       prototype     : (ILandroid/util/TypedValue;Z)I08-09 18:23:58.155: ERROR/dalvikvm(24246):       shorty        : IILZ08-09 18:23:58.155: ERROR/dalvikvm(24246):       registersSize : 408-09 18:23:58.155: ERROR/dalvikvm(24246):       insSize       : 408-09 18:23:58.178: ERROR/dalvikvm(24246):       outsSize      : 008-09 18:23:58.178: ERROR/dalvikvm(24246):   method 0x4108cf64, rPC 0x4205308e, self->curFrame 0x4104c22408-09 18:23:58.178: ERROR/dalvikvm(24246):   rGLUE 0xbef439f8:08-09 18:23:58.178: ERROR/dalvikvm(24246):     rGLUE->pc 0x41fe8b68, rGLUE->fp 0x4104eeb8, rGLUE->method 0x4108d5b4:08-09 18:23:58.178: ERROR/dalvikvm(24246):       android.content.res.AssetManager.getResourceValue()08-09 18:23:58.178: ERROR/dalvikvm(24246):       prototype     : (ILandroid/util/TypedValue;Z)Z08-09 18:23:58.178: ERROR/dalvikvm(24246):       shorty        : ZILZ08-09 18:23:58.178: ERROR/dalvikvm(24246):       registersSize : 808-09 18:23:58.178: ERROR/dalvikvm(24246):       insSize       : 408-09 18:23:58.178: ERROR/dalvikvm(24246):       outsSize      : 408-09 18:23:58.178: INFO/dalvikvm(24246): Stack overflow, expanding (0x4104c200 to 0x4104c000)08-09 18:23:58.178: INFO/dalvikvm(24246): Current stack size is 1228808-09 18:23:58.178: INFO/dalvikvm(24246): "main" prio=5 tid=3 RUNNABLE08-09 18:23:58.178: INFO/dalvikvm(24246):   | group="main" sCount=0 dsCount=0 s=N obj=0x4001e368 self=0xbd9008-09 18:23:58.178: INFO/dalvikvm(24246):   | sysTid=24246 nice=0 sched=0/0 cgrp=unknown handle=-1343993120

onCreate() from NSBHSActivity, as requested:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab

// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, DayActivity.class);

// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("day").setIndicator("Day",
res.getDrawable(R.drawable.ic_tab_day))
.setContent(intent);
tabHost.addTab(spec);

// Do the same for the other tabs
intent = new Intent().setClass(this, WeekActivity.class);
spec = tabHost.newTabSpec("week").setIndicator("Week",
res.getDrawable(R.drawable.ic_tab_day))
.setContent(intent);
tabHost.addTab(spec);

tabHost.setCurrentTab(1);

}

如果您需要额外的信息,请发表评论。另外,正如我所说,这是我的第一个 Android 应用程序,但我在 Java 方面有很好的经验。

最佳答案

我不认为android:theme="@android:style/Theme.NoTitleBar"是一个有效的标签..删除它并检查。

关于Android应用Force打开后立即关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6993491/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com