0

无法解决此错误。我在 libs 文件夹中安装了所需的 Lib 文件。

private void GetYTData ()
{

    YouTubeService ytservice = new YouTubeService("AppName",Dev_Key);   
}

线

YouTubeService ytservice = new YouTubeService("AppName",Dev_Key);

它给了我以下 Log cat 错误

threadid=1: thread exiting with uncaught exception (group=0x40a4e1f8)
FATAL EXCEPTION: main
    java.lang.ExceptionInInitializerError
    at com.twistedequations.pixel.enemy.Pixel_Enemy_Videos_Fragments.GetYTData(Pixel_Enemy_Videos_Fragments.java:131)
    at com.twistedequations.pixel.enemy.Pixel_Enemy_Videos_Fragments.access$1(Pixel_Enemy_Videos_Fragments.java:128)
    at com.twistedequations.pixel.enemy.Pixel_Enemy_Videos_Fragments$2.onClick(Pixel_Enemy_Videos_Fragments.java:100)
    at android.view.View.performClick(View.java:3511)
    at android.view.View$PerformClick.run(View.java:14110)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:4424)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)
    Caused by: java.lang.ExceptionInInitializerError
    at com.google.gdata.client.Service.<clinit>(Service.java:558)
    ... 14 more
     Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf
    at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399)
    at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387)
    at com.google.gdata.wireformats.AltFormat.<clinit>(AltFormat.java:49)
    ... 15 more
4

1 回答 1

0
java.lang.NoSuchMethodError: 

您在 lib 文件夹中的 jar 似乎不包含任何方法copyOf

如果您的类路径中有旧/新(比您的代码)版本的 jar,则可能会发生这种情况。

我建议检查您用于此服务的 jar 版本。

于 2012-08-13T23:30:45.937 回答