1

我有一个正在开发的应用程序,到目前为止只编辑了 xml,当我尝试调试时我得到了这个:

找不到来源

调试:

Thread [<1> main] (Suspended (exception RuntimeException))  
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2306    
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2356 
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 150    
ActivityThread$H.handleMessage(Message) line: 1244  
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 137 
ActivityThread.main(String[]) line: 5195    
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
Method.invoke(Object, Object...) line: 511  
ZygoteInit$MethodAndArgsCaller.run() line: 795  
ZygoteInit.main(String[]) line: 562 
NativeStart.main(String[]) line: not available [native method]  

xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#111111"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".NowPlaying" >

<RelativeLayout
    android:id="@+id/rlcontrols"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" >

    <Button
        android:id="@+id/bplay"
        android:layout_width="70dp"
        android:layout_height="70dp"
        android:layout_below="@+id/tvalbum"
        android:layout_centerHorizontal="true"
        android:background="@drawable/play"
        android:contentDescription="@+string/play" />

    <Button
        android:id="@+id/bprevious"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_below="@id/tvalbum"
        android:layout_marginRight="10dp"
        android:layout_toLeftOf="@id/bplay"
        android:background="@drawable/previous"
        android:contentDescription="@+string/play" />

    <Button
        android:id="@+id/bnext"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_below="@id/tvalbum"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@id/bplay"
        android:background="@drawable/next"
        android:contentDescription="@+string/play" />

    <Button
        android:id="@+id/brepeat"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignBottom="@id/bnext"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@id/bnext"
        android:background="@drawable/repeat"
        android:contentDescription="@+string/play" />

    <Button
        android:id="@+id/bshuffle"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_alignBottom="@id/bprevious"
        android:layout_marginRight="10dp"
        android:layout_toLeftOf="@id/bprevious"
        android:background="@drawable/shuffle"
        android:contentDescription="@+string/play" />

    <SeekBar
        android:id="@+id/songProgressBar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/bplay"
        android:layout_marginTop="10dp"
        android:progressDrawable="@drawable/progress"
        android:thumb="@drawable/seeker" />

    <TextView
        android:id="@+id/tvtime"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/songProgressBar"
        android:gravity="right"
        android:text="@string/time"
        android:textSize="20sp" />
</RelativeLayout>

<TextView
    android:id="@+id/tvalbum"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/rlcontrols"
    android:gravity="center"
    android:text="@string/album"
    android:textSize="20sp" />

<TextView
    android:id="@+id/tvartist"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/tvalbum"
    android:gravity="center"
    android:text="@string/artist"
    android:textSize="20sp" />

<TextView
    android:id="@+id/tvtitle"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@id/tvartist"
    android:gravity="center"
    android:text="@string/title"
    android:textSize="25sp" />

<ImageView
    android:id="@+id/ivalbumart"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@id/tvtitle"
    android:contentDescription="@+string/albumart"
    android:src="@drawable/albumart" />

</RelativeLayout>

如果需要,清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timmo.tampmusicplayer"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.timmo.tampmusicplayer.NowPlaying"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

我不断收到此错误。我试过重新安装 sdk 和 adt/eclipse,什么都没有。我根本不明白是什么导致了这个问题。这是使用 android 工具创建的,我什至看不到我的第一个设计...

4

1 回答 1

1

“找不到源”不是错误。它是 eclipse 的一部分,与您的代码无关。看起来您单击了调试的第一行并被带到了这里。所有“Source not found”都表明 Eclipse 找不到 ActivityThread.java 的源。如果您的应用程序没有启动,那么真正的错误将出现在 Logcat 中。

于 2013-03-22T20:36:09.247 回答