安卓程序无法在模拟器上运行

3

我最近开始使用Eclipse来构建Android应用程序。我已经创建了一个小的Hello_World应用程序,其中包含一个小表格。XML代码如下...

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="1" android:orientation="vertical">


    <TextView 
        android:textAppearance="?android:attr/textAppearanceMedium" 
        android:id="@+id/textView1" 
        android:layout_height="wrap_content" 
        android:text="Hello World!" 
        android:layout_width="wrap_content"  />
    <TableLayout android:layout_height="302dp" android:padding="5dp" android:layout_width="match_parent" android:id="@+id/TransactionLog">
        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Date" android:layout_width="0dip" android:id="@+id/dateLabel"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Details" android:layout_width="0dip" android:id="@+id/detailsLabel"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Debit" android:layout_width="0dip" android:id="@+id/debitLabel"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Credit" android:layout_width="0dip" android:id="@+id/creditLabel"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Balance" android:layout_width="0dip" android:id="@+id/balanceLabel"></TextView>
        </TableRow>
        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="5 October 2011" android:layout_width="0dip" android:id="@+id/date1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="CoCoa Shop" android:layout_width="0dip" android:id="@+id/details1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="123.53" android:layout_width="0dip" android:id="@+id/debit1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="0.00" android:layout_width="0dip" android:id="@+id/credit1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="6729.32" android:layout_width="0dip" android:id="@+id/balance1"></TextView>
        </TableRow>

        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="4 October 2011" android:layout_width="0dip" android:id="@+id/date1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Best Sell" android:layout_width="0dip" android:id="@+id/details1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="900.53" android:layout_width="0dip" android:id="@+id/debit1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="0.00" android:layout_width="0dip" android:id="@+id/credit1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="6729.32" android:layout_width="0dip" android:id="@+id/balance1"></TextView>
        </TableRow>

        <TableRow android:layout_height="wrap_content">
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="4 October 2011" android:layout_width="0dip" android:id="@+id/date1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="Deposit" android:layout_width="0dip" android:id="@+id/details1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="0.00" android:layout_width="0dip" android:id="@+id/debit1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="9500.00" android:layout_width="0dip" android:id="@+id/credit1"></TextView>
            <TextView android:layout_margin="4dip" android:layout_weight="1" android:padding="10dip" android:layout_height="wrap_content" android:text="6729.32" android:layout_width="0dip" android:id="@+id/balance1"></TextView>
        </TableRow>
    </TableLayout>




</LinearLayout>

以下是Hello_World应用程序的Java代码...

package com.example.helloandroid2;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class HelloAndroid2Activity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        TextView tv = new TextView(this);
        tv.setText("Hello, Android");
        setContentView(tv);

    }
}

然而,当我尝试运行我的应用程序时,它显示以下错误... 有人可以帮助我找出我的错误所在吗?

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3470), pid=5220, tid=2000
#  Error: ShouldNotReachHere()
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode windows-x86 )
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Documents and Settings\s4778694\workspace\HelloAndroid2\hs_err_pid5220.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

编辑

以下是.log文件中的内容(很抱歉我无法确定文件中的主要点,因此我将整个文件都贴出来了)

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (classFileParser.cpp:3470), pid=5220, tid=2000
#  Error: ShouldNotReachHere()
#
# JRE version: 7.0-b147
# Java VM: Java HotSpot(TM) Client VM (21.0-b17 mixed mode windows-x86 )
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

---------------  T H R E A D  ---------------

Current thread (0x003d7000):  JavaThread "Unknown thread" [_thread_in_vm, id=2000, stack(0x00900000,0x00950000)]

Stack: [0x00900000,0x00950000],  sp=0x0094f6dc,  free space=317k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [jvm.dll+0x1630e1]
V  [jvm.dll+0x15dcfb]
V  [jvm.dll+0x18e37]
V  [jvm.dll+0x1a6a8]
V  [jvm.dll+0x2a42f]
V  [jvm.dll+0x2b818]
V  [jvm.dll+0x2bedb]
V  [jvm.dll+0x2bf2a]
V  [jvm.dll+0x2c07d]
V  [jvm.dll+0x2c15a]
V  [jvm.dll+0x2c3d7]
V  [jvm.dll+0x73cb1]
V  [jvm.dll+0x7406b]
V  [jvm.dll+0x121a7c]
V  [jvm.dll+0x14382a]
V  [jvm.dll+0xa2940]
C  [javaw.exe+0x1359]
C  [javaw.exe+0x1dc9]
C  [javaw.exe+0xa0cb]
C  [javaw.exe+0xa155]
C  [kernel32.dll+0xb729]  GetModuleFileNameA+0x1ba


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )

Other Threads:

=>0x003d7000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=2000, stack(0x00900000,0x00950000)]

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread: None

Dynamic libraries:
0x00400000 - 0x0042f000     C:\Program Files\Java\jre7\bin\javaw.exe
0x7c900000 - 0x7c9b2000     C:\WINDOWS\system32\ntdll.dll
0x7c800000 - 0x7c8f6000     C:\WINDOWS\system32\kernel32.dll
0x77dd0000 - 0x77e6b000     C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 - 0x77f03000     C:\WINDOWS\system32\RPCRT4.dll
0x77fe0000 - 0x77ff1000     C:\WINDOWS\system32\Secur32.dll
0x7e410000 - 0x7e4a1000     C:\WINDOWS\system32\USER32.dll
0x77f10000 - 0x77f59000     C:\WINDOWS\system32\GDI32.dll
0x773d0000 - 0x774d3000     C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.6028_x-ww_61e65202\COMCTL32.dll
0x77c10000 - 0x77c68000     C:\WINDOWS\system32\msvcrt.dll
0x77f60000 - 0x77fd6000     C:\WINDOWS\system32\SHLWAPI.dll
0x76390000 - 0x763ad000     C:\WINDOWS\system32\IMM32.DLL
0x629c0000 - 0x629c9000     C:\WINDOWS\system32\LPK.DLL
0x74d90000 - 0x74dfb000     C:\WINDOWS\system32\USP10.dll
0x78aa0000 - 0x78b5e000     C:\Program Files\Java\jre7\bin\msvcr100.dll
0x6d940000 - 0x6dc61000     C:\Program Files\Java\jre7\bin\client\jvm.dll
0x71ad0000 - 0x71ad9000     C:\WINDOWS\system32\WSOCK32.dll
0x71ab0000 - 0x71ac7000     C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 - 0x71aa8000     C:\WINDOWS\system32\WS2HELP.dll
0x76b40000 - 0x76b6d000     C:\WINDOWS\system32\WINMM.dll
0x76bf0000 - 0x76bfb000     C:\WINDOWS\system32\PSAPI.DLL
0x6d8d0000 - 0x6d8dc000     C:\Program Files\Java\jre7\bin\verify.dll
0x6d370000 - 0x6d390000     C:\Program Files\Java\jre7\bin\java.dll
0x6d920000 - 0x6d933000     C:\Program Files\Java\jre7\bin\zip.dll

VM Arguments:
jvm_args: -Dfile.encoding=Cp1252 -Xbootclasspath:C:\Program Files\Android\android-sdk\platforms\android-13\android.jar 
java_command: <unknown>
Launcher Type: SUN_STANDARD

Environment Variables:
CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip
PATH=C:/Program Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program Files/Java/jre7/lib/i386;C:\php\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ThinkPad\ConnectUtilities;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\TortoiseSVN\bin;C:\Documents and Settings\s4778694\Desktop\eclipse;
USERNAME=s4778694
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 6 Model 14 Stepping 8, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows XP Build 2600 Service Pack 3

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 14 stepping 8, cmov, cx8, fxsr, mmx, sse, sse2, sse3

Memory: 4k page, physical 1046864k(59376k free), swap 2514760k(1088876k free)

vm_info: Java HotSpot(TM) Client VM (21.0-b17) for windows-x86 JRE (1.7.0-b147), built on Jun 27 2011 02:25:52 by "java_re" with unknown MS VC++:1600

time: Wed Oct 05 14:05:49 2011
elapsed time: 0 seconds

你能发布一下.log文件里的内容吗? - Kevin Qiu
没错!我刚放上去了... - BurninatorDor
你的应用程序还是模拟器崩溃了?如果是你的应用程序,能否发布LOGCAT输出? - slayton
你确定 Java SDK 已经正确安装了吗?尝试在命令提示符中输入 java 然后查看结果。 - Urban
1个回答

4

您正在使用Java7。我怀疑Android应用程序构建与其不兼容。作为第一步,请降级到Java 6并尝试。


1
安装JDK 6而不是7后,它完美地工作了...非常感谢! - BurninatorDor
1
顺便说一下,我在adt-dev邮件列表上发布了这个问题,看看他们是否正在解决它。 - Manfred Moser

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接