jcabi-github
jcabi-github copied to clipboard
Does jcabi-github support Android?
Hello did you know if jcabi-github work on Android?
@letroll I haven't tried, but I don't see any reasons why it wouldn't.. please, try and let us know if something doesn't work, we'll try to fix
Hi guys, it seems that importing javax.xml.bind.DatatypeConverter won't make it work on Android...
Was currently debugging some bug on Android Device, and I found this similar problem : https://github.com/fernandezpablo85/scribe-java/issues/359
Checked out the constructor in RtGitHub.java, at line 117 :
public RtGithub(
@NotNull(message = "user name can't be NULL") final String user,
@NotNull(message = "password can't be NULL") final String pwd) {
this(
RtGithub.REQUEST.header(
HttpHeaders.AUTHORIZATION,
String.format(
"Basic %s",
DatatypeConverter.printBase64Binary(
String.format("%s:%s", user, pwd)
.getBytes(Charsets.UTF_8)
)
)
)
);
}
and in line 43:
import javax.xml.bind.DatatypeConverter;
According to my Logcat, the program is throwing exception once the constructor is called.
With my logcat !
12-10 10:26:32.430 29155-29543/ray.nm_final_test2 I/dalvikvm﹕ Could not find method javax.xml.bind.DatatypeConverter.printBase64Binary, referenced from method com.jcabi.github.RtGithub.<init>
12-10 10:26:32.435 29155-29543/ray.nm_final_test2 W/dalvikvm﹕ VFY: unable to resolve static method 18449: Ljavax/xml/bind/DatatypeConverter;.printBase64Binary ([B)Ljava/lang/String;
besides I'm including jcabi-github-0.18-jar-with-dependencies.jar
sounds like a bug on our side. let us try to fix it.
@lthuangiang the task is yours, the budget is 30 mins, please go ahead
@lthuangiang the task is overdue, and I have to re-assign it to someone else. Please, stop working with it immediately. In general, we're against overdue tasks, check this page
@nathansgreen the task is yours
@dmarkov please assign to someone else.
@dmarkov please assign to someone else.
@nathansgreen right, I will find someone else, no problem
@pinaf please go ahead, it's your task now, keep this in mind, and don't hesitate to ask any technical questions you may have
30 mins is the budget of the task. This is exactly how much will be paid when the problem is solved (no matter how much time you will actually spend). See this for more information
@dmarkov please assign to someone else - no experience with android dev and no phone to test.
@dmarkov please assign to someone else - no experience with android dev and no phone to test.
@pinaf got it, someone else will be assigned soon
@oruam85 the task is yours
@dmarkov please assign to someone else
@dmarkov please assign to someone else
@oruam85 got it, someone else will be assigned soon
@adko-pl the task is yours
@dmarkov please assign to someone else
@dmarkov please assign to someone else
@adko-pl I will assign somebody else to this issue
There are two issues here.
- The RtGithub class creates the USER_AGENT constant using the manifest file. Android repacks all libraries and the 'JCabi-Version' property and other similar properties doesn't exist in apk. All RtGithub constructors don't work. They throw:
java.lang.IllegalArgumentException: Attribute 'JCabi-Version' not found in MANIFEST.MF file(s) among 2 other attribute(s): ["Created-By", "Manifest-Version"]
Solutions: 1.1) build simple constant (my PR do that :( )
or
1.2) create a resource properties file that will contain this property. It can be created during maven build (better solution)
- The second problem is described above. It happens when first issue is solved and only for "new RtGithub(user,pwd)" constructor.
The Dalvik can't find javax.xml.bind.DatatypeConverter
Solutions:
2.1) bypass somehow Android restriction (repack jar or similar...). I haven't managed to solve the problem this way, although there are different recommendations.
or
2.2) I have created the RtDatatypeConverter class based on DatatypeConverterImpl from OpenJDK. The class will use standard DatatypeConverter if exists or the method(s) copied from DatatypeConverterImpl.
I have tested the following code:
RtGithub github = new RtGithub("pecko", "MYPWD");
Repo repo = github.repos().get(new Coordinates.Simple("jcabi/jcabi-github"));
Issues issues = repo.issues();
within a Android activity.
Notice: The PR probably requires some improvement, but, for now, I have analyzed the issue and made simple PR. Please advice.
There are also some comment in the code.
I have also fixed checkstyle errors in RtGithub, but I have just excluded that from RtDatatypeConverter because it is mostly copied. PMD errors are fixed.
@darkled I will solve all issues you described in the PR, but firstly want to that we agree about solutions. I have described two issues and offer two solutions. You want to say that my solution are fine beside soving your comment. Right?
@darkled @dmarkov
I have committed final solution (I hope). It builds on my local machine. I have also updated the PR description. See https://github.com/jcabi/jcabi-github/pull/1162/
AppVeyor and Travis have passed. All seems good.
@pecko This task is yours, please go ahead keeping in mind this. If any questions, don't hesitate to ask right here. This task's budget is 30 mins. This is exactly how much will be paid when the problem explained above is solved. See this for more information
@dmarkov
I have solved what I can. Please look at https://github.com/jcabi/jcabi-github/pull/1162. Travis, AppVeyor passed with no issues, but rultor fails. I have open the issue against rultor https://github.com/yegor256/rultor/issues/940
@darkled @dmarkov
I have updated the PR based on comment at https://github.com/yegor256/rultor/issues/940#issuecomment-143786271
@darkled @dmarkov
I have changed commit/ It just fixes puzzle instead of remove it. I'm not sure that it is fixed in #920
@dmarkov we are waiting for #1170
@dmarkov we are waiting for #1170
@darkled yes, of course, we'll wait for #1170
@rajithd please go ahead, it's your task now, keep this in mind, and don't hesitate to ask any technical questions you may have; The budget of this task is 30 mins. This is exactly how much time will be compensated, when the task is completed. Read about our Definition of Done