简体   繁体   中英

How can I login to Github with the egit-github Java library?

I use the library egit-github

I use gradle to import the library

    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.

 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.

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'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM