2013-04-16 32 views
2

出於某種原因,我收到錯誤Package X requires unavailable shared library com.android.future.usb.accessory軟件包X需要不可用的共享庫com.android.future.usb.accessory

該庫包含在Project Explorer中的項目文件夾下。 [Project Folder] - > Google API [Android 2.3.3] - > usb.jar - > com.android.future.usb - > UsbAccessory.class,UsbManager.class。

我正在使用Google APIs 2.3.3(API 10)。我需要它,因爲我將它連接到Arduino USB Host Shield。我一直在我的手機上調試到目前爲止,但現在我需要日誌和調試信息,因爲我的程序由於某種原因沒有發送數據,我無法弄清楚原因。當我連接到我的電腦時,程序至少會加載並執行某些操作(而不是使用AVD)。使用模擬器,無需加載。

我使用Android 4.2.2(API 17)的Android虛擬設備。

我的清單包括以下內容:

<application android:icon="@drawable/ic_launcher" android:label="@string/app_name"> 
     <uses library android:name="com.android.future.usb.accessory"></uses-library> 
     <activity android:name="ArduinoActivity" android:label="@string/app_name" android:launchMode="singleTask"> 
     <intent-filter> 
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
     <intent-filter> 
     <action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" /> 
     </intent-filter> 
     <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" android:resource="@xml/accessory_filter" /> 
     </activity> 
    </application> 

更新:我已經改變了我的API到Android 3.1(API 12)。我已經把庫改爲android.hardware.usb.accessory(而不是com.android.future.usb.accessory)。出於某種原因,我仍然從PackageManager中得到一個錯誤(這次是新庫)。我注意到它從清單中拉取了這個庫名稱。有什麼想法嗎?仍然有同樣的問題!

解決方案更新:我忘了將<uses-library />更改爲<uses-feature />。有關Android的更多文檔與適用於USB的Google API & USB附件:http://developer.android.com/guide/topics/connectivity/usb/accessory.html

回答

1

USB輔助模式在API 2.3.3中不適用,僅適用於2.3.4及更高版本。 Read here.

+0

奇怪。我想知道爲什麼它包含在2.3.3中。謝謝你的收穫。我將在安裝並運行3.0時進行更新。 – BLaZuRE

+0

@BLaZuRE沒問題,聽起來不錯。 – TronicZomB

相關問題