2013-03-18 24 views
0

香港專業教育學院開始開發一個應用程序,我還沒有改變的類,也改變了清單,只有創建的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=".Playing" > 

<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_marginTop="10dp" 
     android:layout_height="wrap_content" 
     android:progressDrawable="@drawable/progress" 
     android:thumb="@drawable/seeker" 
     android:layout_below="@id/bplay" /> --> 

</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> 

調試堆棧:

Thread [<1> main] (Suspended (exception RuntimeException)) 
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2100  
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2125 
ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 140  
ActivityThread$H.handleMessage(Message) line: 1227 
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
Looper.loop() line: 137 
ActivityThread.main(String[]) line: 4898  
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] 
Method.invoke(Object, Object...) line: 511 
ZygoteInit$MethodAndArgsCaller.run() line: 1006 
ZygoteInit.main(String[]) line: 773 
NativeStart.main(String[]) line: not available [native method] 

說源沒有發現,當我開始練習

我不知道這意味着什麼,所以任何幫助WOU LD非常感謝

+0

顯示更多的日誌,它會更清楚。 – 2013-03-18 17:46:23

+0

完整堆棧跟蹤 – njzk2 2013-03-18 17:55:11

回答

1

沒有你的項目我只能猜測,但通常這是由Manifest文件不正確造成的。確保你的包是正確的,然後你需要調出類似於你的活動

<activity 
    android:label="@string/app_name" 
    android:name=".MyLaunchActivity" > 
    <intent-filter > 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
    </intent-filter> 
</activity> 
<activity android:name=".My_Second_Activity" > 
</activity> 
+0

我的清單是正確的,完全如您所願。我搜索了我的整個項目,沒有發現任何失序:/ – Timmo 2013-03-18 19:28:22

1

我剛剛通過類似的問題,因爲我錯過了appcompat_v7庫。就我而言,假設我的項目名稱是Prj_A。 要知道哪些圖書館PrjA需要,您必須閱讀project.properties文件(請參閱項目的根目錄)。

對於project.properties文件中提到的所有資源,您需要添加該庫。讓我們說Lib_1,Lib_2 ... Lib_n 這意味着你必須導入「作爲android項目」每個Lib_x從Prj_A的project.properties文件請求,然後轉到Prj_A,右鍵單擊Properties,Android。彈出一個窗口,查看底部的框架,顯示Prj_A的庫。確保你在每個提到的圖書館前都有一個綠色標記。

對於所有帶有紅色問號的庫或每個缺失的庫,需要在顯示庫的框架中執行以下步驟: 單擊添加按鈕,它將彈出一個包含所有庫候選項的窗口(即在您的工作空間中導入和打開)。 如果你沒有圖書館,你正在尋找你需要導入並首先打開你的工作空間。

然後每個帶有紅色問號的庫都需要刪除。因此,在顯示圖書館的框架中,點擊紅色「?」圖書館並點擊刪除按鈕。然後點擊應用。