Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nexcloud stop to work while opening PDF Files #3994

Closed
Handoz49 opened this issue May 9, 2019 · 25 comments · Fixed by #4041
Closed

Nexcloud stop to work while opening PDF Files #3994

Handoz49 opened this issue May 9, 2019 · 25 comments · Fixed by #4041

Comments

@Handoz49
Copy link

Handoz49 commented May 9, 2019

Hi,
We have just install a Nextcloud Server to change our owncloud solution but when using the last nextcloud playstore version on a samsung android tablet (android 7) the application stopped while opening or scrolling over a PDF file. Same issue with a samsung android phone. Can't check the Log as you removed the expert mode. So I tried to take an older APK : nextcloud-30020199.apk and it's working fine with it. Could you please tell us if it's a known problem which will be fixed because we will have a lot of android with nextcloud using google MDM to deploy and we can't do it with an old APK... Attached the error when application stop (in french sorry)

Best Regards
Screenshot_20190509

@tobiasKaminsky
Copy link
Member

Is this happening only on the first time you try to open a pdf?

Can you provide us additional infos via logcat? https://github.com/nextcloud/android/blob/master/README.md#getting-debug-info-via-logcat

@Handoz49
Copy link
Author

Hello,
no it always happend then nextcloud crash and need to stop. The pdf could open and then application stop few seconds later but if i select a pdf file but i don't chose the application to open with and wait few second the same error happend .. At the beginning i was thinking the problem come from the pdf app but i tried with different one and same problem :(

please find attaches the log but sorry its a full part log as grep command not working on my windows 10 maybe you can find what you want.

Thanks a lot for your help
log.txt

@Handoz49
Copy link
Author

Hello, thanks for your help, so is it a nextcloud bug that will be fixed or do we have something to do from our side?

Thanks

Best Regards

@tobiasKaminsky
Copy link
Member

@ezaquarii do you have in idea how to fix this?
Missing parts on dex list sounds very strange to me…

@ezaquarii
Copy link
Collaborator

ezaquarii commented May 14, 2019

Yes, it looks like it tries to call platform API level 28 down the road: android.view.ViewCompat$OnUnhandledKeyEventListenerWrapper

@Handoz49 run it on Android 7, so this class does not exist in runtime and class loader complains - of course.

Maybe there is some issue reported by google or there are some API-level specific instructions we should follow when integrating androidx, like theme attributes or something?

I'd rule out dead code elimination here, as the missing class is clearly in Android core framework that ships with the phone OS.

Hard to say what happened without doing git bisect on latest changes, but he user provided a version that works for him. I can't decipher the version number - nextcloud-30020199.apk. Rings any bell?

@ezaquarii
Copy link
Collaborator

@Handoz49, did you try on any other Android 7 device?

@Handoz49
Copy link
Author

I did it on my Samsung s7 which is on Android 8 had the same problem

@Handoz49
Copy link
Author

@ezaquarii , I can try on other android 7.0 tomorrow but it will be the same model

@ezaquarii
Copy link
Collaborator

ezaquarii commented May 14, 2019 via email

@AndyScherzinger
Copy link
Member

The referenced version code is release 3.2.1 final build. That version is quite old and long before we migrated to AndroidX... :/

@ezaquarii
Copy link
Collaborator

Same problem in google samples:

android/sunflower#295

@ezaquarii
Copy link
Collaborator

ezaquarii commented May 15, 2019

Relevant google issue:
https://issuetracker.google.com/issues/120750246

Here I found a possible workaround
https://issuetracker.google.com/issues/120750246#comment11

Whomever re-opened this issue, thank you! Stuck on API 27 because of this :(

More options we can consider:

  1. upgrade support library
  2. downgrade support library

@AndyScherzinger
Copy link
Member

Hmm, can this than be a blocker for the dark theme branch (running on 1.1.0 alpha lib releases) also since GPlay demands latest compile targets within a certain time frame is a target downgrade an option?

Also cc @tobiasKaminsky for opinions.

@ezaquarii
Copy link
Collaborator

https://developer.android.com/distribute/best-practices/develop/target-sdk
It looks like it's ok until November 2019 to stick to 27, hoping that they will fix AndroidX.

@AndyScherzinger
Copy link
Member

Then I think downgrade would be fine for now.
What do you think @tobiasKaminsky?

@ezaquarii
Copy link
Collaborator

@tobiasKaminsky @AndyScherzinger @Handoz49
Full stop. My initial investigation was totally wrong. My bad.

The stacktrace was actually just a warning, not a crash. I was too fast to jump into conclusions, so let's forget about it.

The true crash is hidden here:

05-10 16:01:25.129 27435 27435 D AndroidRuntime: Shutting down VM
05-10 16:01:25.130 27435 27435 E AndroidRuntime: FATAL EXCEPTION: main
05-10 16:01:25.130 27435 27435 E AndroidRuntime: Process: com.nextcloud.client, PID: 27435
05-10 16:01:25.130 27435 27435 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke interface method 'boolean com.owncloud.android.utils.DisplayUtils$AvatarGenerationListener.shouldCallGeneratedCallback(java.lang.String, java.lang.Object)' on a null object reference
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at com.owncloud.android.datamodel.ThumbnailsCacheManager$AvatarGenerationTask.onPostExecute(ThumbnailsCacheManager.java:841)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at com.owncloud.android.datamodel.ThumbnailsCacheManager$AvatarGenerationTask.onPostExecute(ThumbnailsCacheManager.java:789)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at android.os.AsyncTask.finish(AsyncTask.java:660)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at android.os.AsyncTask.-wrap1(AsyncTask.java)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:677)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:102)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:154)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:6780)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1500)
05-10 16:01:25.130 27435 27435 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1390)

Looks like an NPE in our own code.

@ezaquarii
Copy link
Collaborator

        protected void onPostExecute(Drawable drawable) {
            if (drawable != null) {
                AvatarGenerationListener listener = mAvatarGenerationListener.get();
                AvatarGenerationTask avatarWorkerTask = getAvatarWorkerTask(mCallContext);

                if (this == avatarWorkerTask && listener.shouldCallGeneratedCallback(mUserId, mCallContext)) {
                    listener.avatarGenerated(drawable, mCallContext);
                }
            }
        }

mAvatarGenerationListener is a weak reference and as such can be null. We don't check for it at all. Easy-peasy.

ezaquarii added a commit that referenced this issue May 18, 2019
ezaquarii added a commit that referenced this issue May 18, 2019
Listener reference was weak and there was no check for null,
causing an NPE.

Fixes #3994

Signed-off-by: Chris Narkiewicz <[email protected]>
@ezaquarii
Copy link
Collaborator

@Handoz49 Could you pls install the APK available here: #4041
and see if that fixed the problem? Just scan the QR code or use the URL.

No need to uninstall - we're using a separate app package to allow parallel installations of QA and whatever other version of Nextcloud you have installed.

@Handoz49
Copy link
Author

@ezaquarii I will try tomorrow at work thanks

@Handoz49
Copy link
Author

@ezaquarii @AndyScherzinger @tobiasKaminsky
Hello, just tried the new APK (9254.apk), looks like it works for PDF, I had one crash but not while checking pdf files and so i tried again for 5 minutes and it did'nt crashed again, maybe bad luck

@Handoz49
Copy link
Author

@ezaquarii I think the crash above come from nextcloud which reinstall because of the MDM strategy while i was using the QA version

@tobiasKaminsky
Copy link
Member

Nice @ezaquarii!
Thanks for finding the real cause and fixing it 🎉

@Handoz49
Copy link
Author

will this fix include in the next nexcloud update on the playstore? if yes how many times do you think it will take to have it? thanks a lot best regards

backportbot-nextcloud bot pushed a commit that referenced this issue May 21, 2019
Listener reference was weak and there was no check for null,
causing an NPE.

Fixes #3994

Signed-off-by: Chris Narkiewicz <[email protected]>
@AndyScherzinger AndyScherzinger added this to the Nextcloud App 3.6.2 milestone May 21, 2019
@tobiasKaminsky
Copy link
Member

I will release a RC1 of upcoming version today, which can be get via beta program on gplay.
Final will be ~Thursday.

@AndyScherzinger
Copy link
Member

Final release 3.6.2 has been published today so it should be available on Google Play very soon and wihtin some days via f-droid too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants