[英]How can I login to Github with the egit-github Java library?
I use the library egit-github 我使用库egit-github
I use gradle to import the library 我用gradle导入库
compile 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:3.7.0.201502260915-r'
And I try the code just like the example in the readme.md in the above link. 然后,就像上面链接中的readme.md中的示例一样,尝试代码。
GitHubClient client = new GitHubClient(); // this line throw exception
client.setCredentials("xxxxxx", "3xxxxxxx");
But it throw exception like below 但是它抛出如下异常
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)
I hope some kind people can help me. 希望有人能帮助我。
I just add gson into the gradle file and fix this problem.Because the egit-github library depends on GSON. 我只是将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'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.