2012-12-29 40 views
0

我是一位Java人,最近開始探索Android,我正在研究YouTube上的Youtube Data API以查詢YouTube視頻。YouTubeQuery API - NoClassDefFoundError - Android

我在我的項目依賴項中添加了以下jar作爲外部jar。

  • 的activation.jar
  • GDATA-客戶1.0.jar
  • GDATA客戶端 - 間 - 1.0.jar
  • GDATA核-1.0.jar
  • GDATA-的YouTube-2.0。罐子
  • 的mail.jar
  • servlet的api.jar文件

鱈魚e編譯好,但是當我在模擬器中運行應用程序,我得到這個異常

AndroidRuntime(784): java.lang.NoClassDefFoundError: com.google.gdata.client.youtube.YouTubeQuery 

我正在使用eclipse Juno。

這裏是我的.classpath

<?xml version="1.0" encoding="UTF-8"?> 
<classpath> 
    <classpathentry kind="src" path="src"/> 
    <classpathentry kind="src" path="gen"/> 
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> 
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> 
    <classpathentry kind="lib" path="C:/apache-tomcat-6.0.36-windows-x64/apache-tomcat-6.0.36/lib/servlet-api.jar"/> 
    <classpathentry kind="lib" path="C:/Vishwas/gdata-samples.java-1.47.1/gdata/java/lib/gdata-client-1.0.jar"/> 
    <classpathentry kind="lib" path="C:/Vishwas/gdata-samples.java-1.47.1/gdata/java/lib/gdata-client-meta-1.0.jar"/> 
    <classpathentry kind="lib" path="C:/Vishwas/gdata-samples.java-1.47.1/gdata/java/lib/gdata-core-1.0.jar"/> 
    <classpathentry kind="lib" path="C:/Vishwas/gdata-samples.java-1.47.1/gdata/java/lib/gdata-youtube-2.0.jar"/> 
    <classpathentry kind="lib" path="C:/Users/Vishwas/Downloads/activation.jar"/> 
    <classpathentry kind="lib" path="C:/Users/Vishwas/Downloads/mail.jar"/> 
    <classpathentry kind="lib" path="libs/activation.jar"/> 
    <classpathentry kind="output" path="bin/classes"/> 
</classpath> 

感謝

+0

你把罐子在libs文件夾?如果你這樣做,應該自動重新識別它們,你也有導入語句在你的類的頂部import com.google.gdata.client.youtube.YouTubeQuery? – vodich

+0

是的,我已經嘗試將它添加到庫文件夾,是的,進口就在那裏!沒有什麼能幫助我克服這個錯誤。 – Cavish

+0

也許你必須在清單文件中定義它 – vodich

回答

0

它爲我工作終於!

這是我做的。

1)刪除了我通過添加的所有外部jar,屬性 - > JavaBuildPath - >庫 2)直接將所有jar添加到libs文件夾。

它的工作就像一個魅力。我仍然不確定,爲什麼當我將它添加爲外部罐子時,它沒有使用罐子。

這是我最新的.classparth!

<?xml version="1.0" encoding="UTF-8"?> 
<classpath> 
    <classpathentry kind="src" path="src"/> 
    <classpathentry kind="src" path="gen"/> 
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/> 
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/> 
    <classpathentry exported="true" kind="lib" path="libs/activation.jar"/> 
    <classpathentry exported="true" kind="lib" path="libs/android-support-v4.jar"/> 
    <classpathentry exported="true" kind="lib" path="libs/gdata-client-1.0.jar"/> 
    <classpathentry exported="true" kind="lib" path="libs/gdata-client-meta-1.0.jar"/> 
    <classpathentry exported="true" kind="lib" path="libs/gdata-youtube-2.0.jar"/> 
    <classpathentry exported="true" kind="lib" path="libs/mailapi.jar"/> 
    <classpathentry exported="true" kind="lib" path="libs/servlet-api.jar"/> 
    <classpathentry kind="output" path="bin/classes"/> 
</classpath> 

感謝

相關問題