Error in dhis2-android-skeleton-app fresh build

I have cloned the sdk-skeleton app from GitHub. While building it, I get the following errors(many of them lint issues).


You can set environment variable LINT_PRINT_STACKTRACE=true to dump a full stacktrace to stdout. [LintError]
/Users/keronei/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-jexl/2.1.1/6ecc181debade00230aa1e17666c4ea0371beaaa/commons-jexl-2.1.1.jar: Error: Invalid package reference in org.apache.commons:commons-jexl; not included in Android: javax.script. Referenced from org.apache.commons.jexl2.scripting.JexlScriptEngine. [InvalidPackage]

/Users/keronei/.gradle/caches/modules-2/files-2.1/nl.jqno.equalsverifier/equalsverifier/2.1.6/9b4f5b94534108530a4140187cfa26986cd092a8/equalsverifier-2.1.6.jar: Error: Invalid package reference in nl.jqno.equalsverifier:equalsverifier; not included in Android: java.lang.instrument. Referenced from nl.jqno.equalsverifier.internal.lib.bytebuddy.dynamic.ClassFileLocator.AgentBased. [InvalidPackage]

It has two suggestions to ignore this lint issues.

Regardless of the lint issues, I did ran the app but unfortunately I don’t seem to go past the login, carefully observation on the log reveals that the local handling of response is the problem,


2020-06-08 17:06:15.481 16740-16740/com.example.android.androidskeletonapp W/System.err: java.lang.RuntimeException: org.hisp.dhis.android.core.maintenance.AutoValue_D2Error
2020-06-08 17:06:15.482 16740-16740/com.example.android.androidskeletonapp W/System.err:     at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
2020-06-08 17:06:15.482 16740-16740/com.example.android.androidskeletonapp W/System.err:     at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:93)
2020-06-08 17:06:15.482 16740-16740/com.example.android.androidskeletonapp W/System.err:     at io.reactivex.Completable.blockingAwait(Completable.java:1227)
2020-06-08 17:06:15.482 16740-16740/com.example.android.androidskeletonapp W/System.err:     at org.hisp.dhis.android.core.user.internal.UserAuthenticateCallFactory.loginOnline(UserAuthenticateCallFactory.java:165)
2020-06-08 17:06:15.483 16740-16740/com.example.android.androidskeletonapp W/System.err:     at org.hisp.dhis.android.core.user.internal.UserAuthenticateCallFactory.loginInternal(UserAuthenticateCallFactory.java:140)
2020-06-08 17:06:15.483 16740-16740/com.example.android.androidskeletonapp W/System.err:     at org.hisp.dhis.android.core.user.internal.UserAuthenticateCallFactory.lambda$logIn$0$UserAuthenticateCallFactory(UserAuthenticateCallFactory.java:121)

After this, when I restart the app, it crashes with a stack trace that user credentials were not found

'java.lang.String org.hisp.dhis.android.core.user.User.displayName()' on a null object reference
        at com.example.android.androidskeletonapp.ui.main.MainActivity.onCreate(MainActivity.java:72)

It seems to me that after successful authentication, the flag for isLoggedIn is saved as true but the credentials are not, which results to bypassing the login page but cannot load the main activity because there are no credentials.

The stack that is printed after providing correct credentials and returning login failed includes one D2Error.java file, In this file, some entries are not recognised.

*return AutoValue_D2Error.createFromCursor(cursor);*

AutoValue_D2Error is not recognised and is in red, In some way, I thought this could be the culprit because it is involved in the process of persisting user credentials.

I didn’t want to manipulate this configuration further, it could be possible that I have missed something small.

I have done git clone repo-link, git clone --recurse-submodules https://github.com/dhis2/dhis2-android-skeleton-app.git, have also upgraded the sdk to 1.1.1, I have also cloned the sdk separately and included in a different project but I seem to be stuck still.

regards.

Hey , @vgarciabnz can you help @Keronei?

Hey @Keronei,

thanks for the detailed error log, it is very helpful to find the issue. We will take a look and come back to you.

Just to be sure to replicate the issue, did you use master branch? So the only modification was to upgrade the sdk to version 1.1.1, wasn’t it?

Regards

Yes.
That was the only modification I made at first.

Later I switched to use-cases but there was no change still, same error.

Hi Keronei,

Thanks a lot for your message with such a detailed description. It actually made us realize that there is indeed bug in the SDK.

We will fix it and let you know as soon as you can use the corrected version with the skeleton app.

However, you should be able to click on the app from your phone and clear the storage, removing this inconsistent state.

Please let us know if this solves your problem and you can successfully log in.

Are you using one of the test servers or your own implementation?

Thanks a lot.

Seems like clearing the storage doesn’t effect the behaviour.
I’ll be trying possible fixes around google’s autovalue in the meanwhile while I wait for your fix.

I use a test instance deployed in our country.

Hi Keronei,

Ok, the reason why it might be failing is that there is something in your server that makes the call to /system/info return a failure. Could that be the case?

I think it doesn’t have anything to do with Autovalue.

If you don’t mind, maybe you can send me some credentials for your test server and I can debug it myself. You can send me a private message for that if you prefer.

Hi @Keronei,

We have checked with the credentials you sent us.

Please note that http://test.hiskenya.org (http://test.hiskenya.org/) is no actual DHIS URL. The two actual DHIS URLs are:

  1. https://test.hiskenya.org/dhiske
  2. https://test.hiskenya.org/tracker

Both with HTTPS, not with HTTP.

For the first (dhiske), I was able to log in in the skeleton app. I also tried to download the metadata but it takes several minutes since the user has too many organisation units assigned.You can check the documentation for organisation units recommendations.

The credentials weren’t right for the second server (tracker). I wasn’t able to log in neither in the skeleton app nor in the web.

I will create a ticket to improve the error messages and the logging in the skeleton app so it’s easier for you to track was went wrong.

Please let me know if this solves your issues.

Thanks @vgarciabnz,

It’s actually working with your observation. Have been wondering how possible it could be that such an error exists on a tightly tested codebase.

I appreciate your efforts alot.