2015-07-02 80 views
1

我使用的庫egit-github如何使用egit-github Java庫登錄到Github?

我使用gradle這個導入庫

compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r' 

我嘗試,就像在上面的鏈接readme.md的例子的代碼。

GitHubClient client = new GitHubClient(); // this line throw exception 
client.setCredentials("xxxxxx", "3xxxxxxx"); 

但它拋出異常像下面

07-02 21:08:28.620 30789-32145/com.example.quinn.githubknife E/AndroidRuntime﹕ FATAL EXCEPTION: Thread-12108 
Process: com.example.quinn.githubknife, PID: 30789 
java.lang.VerifyError: org/eclipse/egit/github/core/client/GitHubClient 
     at com.example.quinn.githubknife.MainActivity$1$1.run(MainActivity.java:31) 
     at java.lang.Thread.run(Thread.java:841) 

我希望有好心人能幫助我。

+0

您是否在Android應用程序中使用庫? – Codebender

+0

似乎'egit-github'不是Dalvik兼容的,可能是因爲Dalvik實際上並不是一個正確的,完全實現的JVM,並且不支持完整的Java規範。 – Esko

+0

@Codebender我在Android應用程序中使用它, –

回答

0

我只是將gson添加到gradle文件中並解決了這個問題。因爲egit-github庫取決於GSON。

compile fileTree(dir: 'libs', include: ['*.jar']) 
compile 'com.android.support:appcompat-v7:22.2.0' 
compile 'com.google.code.gson:gson:2.3.1' 
compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r'