2010-11-02 40 views
1

我想通過谷歌數據API獲取我的博客數據谷歌Android Data API的崩潰

我寫了這個代碼:

public class blogger extends Activity 
{ 

    private GoogleService myService; 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 

     myService = new GoogleService("blogger", "test-blogger-0"); 
     try { 
      myService.setUserCredentials("[email protected]", "112233"); 
     } catch (AuthenticationException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
    } 
} 

,但它總是在墜毀:爲myService =新GoogleService( 「博客」 ,「test-blogger-0」);

扔了「java.lang.ExceptionInInitializerError」

有人能告訴我爲什麼嗎?

+0

我有同樣的錯誤,不知道如何解決這個問題。 – Orlando 2011-06-16 20:41:40

回答

3

那麼我做了一些研究,並解決了這個問題,包括以下與谷歌軟件開發工具包附帶的罐子:google-collect-1.0-rc1.jar和jsr305.jar與這些罐子添加到構建路徑我現在可以成功在沒有上述例外的情況下實例化GoogleService。