我有一个开发中的应用程序,到目前为止只编辑了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工具创建的,我甚至无法看到我的第一个设计......
答案 0 :(得分:1)
“未找到来源”不是错误。它是eclipse的一部分,与你的代码无关。看起来你点击了调试的第一行,你就被带到了这里。所有“未找到源”表示Eclipse无法找到ActivityThread.java的源代码。如果您的应用程序没有启动,真正的错误将出现在Logcat中。