ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.63k stars 2.23k forks source link

V2.13: Answer buttons not appearing in Reviewer #7369

Closed benjaminor closed 3 years ago

benjaminor commented 4 years ago
Reproduction Steps
  1. Select deck to review
  2. Question page is nearly blank (only note and "show answer" button)
  3. Right answer page is also blank

See pictures: Screenshot_20201008-142047_AnkiDroid Screenshot_20201008-142059_AnkiDroid

Expected Result

Question and answer page should be as usual, with the buttons there.

Debug info

AnkiDroid Version = 2.13.5

Android Version = 8.0.0

ACRA UUID = 80fce863-4876-45bc-9e26-1b657faa1f28

Scheduler = std

Research

Enter an [x] character to confirm the points below:

welcome[bot] commented 4 years ago

Hello! ๐Ÿ‘‹ Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

david-allison commented 4 years ago

Hi @benjaminor, thanks for the report.

Could you confirm that this is an issue with 2.13.5:

Download https://github.com/ankidroid/Anki-Android/releases/download/v2.13.4/AnkiDroid-2.13.4.parallel.A.apk and see if this also has the same problem.

david-allison commented 4 years ago

I can't immediately see any reason why this should be happening: https://github.com/ankidroid/Anki-Android/compare/v2.13.4...v2.13.5

david-allison commented 4 years ago

@benjaminor,

Could you possibly export a deck which has this problem and upload it here, or to a file sharing site so we can ensure it's not a card template problem?

benjaminor commented 4 years ago

Hi @benjaminor, thanks for the report.

Could you confirm that this is an issue with 2.13.5:

Download https://github.com/ankidroid/Anki-Android/releases/download/v2.13.4/AnkiDroid-2.13.4.parallel.A.apk and see if this also has the same problem.

No, I can confirm this is also an issue with 2.13.4, should I also check out another version?

david-allison commented 4 years ago

Yes please, use Parallel.A when downloading. This will really help us track down the issue. Thank you!

https://github.com/ankidroid/Anki-Android/releases/tag/v2.12.1 - should be fine, you can download parallel.B and use this to review while we resolve the problem https://github.com/ankidroid/Anki-Android/releases/tag/v2.13.0 https://github.com/ankidroid/Anki-Android/releases/tag/v2.13.1 https://github.com/ankidroid/Anki-Android/releases/tag/v2.13.2 https://github.com/ankidroid/Anki-Android/releases/tag/v2.13.3

benjaminor commented 4 years ago

As you said, v2.12.1 did not have the issue, but I could reproduce it with v2.13.0 and later.

Interestingly, the buttons still work, they are just not visible anymore. They disappear a short moment after I start the review.

benjaminor commented 4 years ago

@benjaminor,

Could you possibly export a deck which has this problem and upload it here, or to a file sharing site so we can ensure it's not a card template problem?

This one has the issue (all of my decks have), but I suspect the deck is probably not the cause, my decks are quite simple: https://nextcloud.orthen.net/index.php/s/8kLbZLwsTQEKgcj

david-allison commented 4 years ago

@benjaminor Could you try Settings - Advanced - Safe Display Mode on 2.13.5 and see if this fixes it?

Which phone are you using?

benjaminor commented 4 years ago

@benjaminor Could you try Settings - Advanced - Safe Display Mode on 2.13.5 and see if this fixes it?

Which phone are you using?

Unfortunately, this does not resolve the issue. (Neither does disabling the "Optimize battery usage" setting for the app.)

I can go on and test the v2.13.alphaX releases to do a bisect where the bug was introduced?

I'm using a Samsung Galaxy S7 (SM-G930U) which has Android 8.0.0, Samsung Experience Version 9.0 and a kernel 3.18.71-14970140 (if that helps you).

hiacre commented 4 years ago

I saw this exact same issue yesterday. It was working in the morning, and when I used AnkiDroid in the evening, found that the buttons (again/hard/good/easy) weren't appearing. I do not know if the Google Play Store automatically updated the app during the day or not. In addition, I could not see the OS UI when swiping up from the bottom of the phone (this has shortcuts for home, back, running tasks, etc). The OS UI was there (it reacted to presses), it just wasn't visible.

AnkiDroid version 2.13.5 Android version 8.0 Phone LG G5 (LG-H850) Kernel 3.18.71-perf+ Settings > Advanced > Safe display mode set to "enabled" did not fix the problem.

I uninstalled the Google Store version of AnkiDroid, and began installing various tagged releases to find which versions worked and where the breakage appeared. I found that all versions I tried (2.12.1, 2.13alphaX, 2.13betaX, 2.13.X) worked.

When I reinstalled the Google Store version of AnkiDroid (v2.13.5), I found that I could no longer reproduce the issue.

binarin commented 4 years ago

I can see the same, but only on 1 of the 2 phones. Both have 2.13.5 installed. What's interesting is that all buttons (answer buttons at the bottom and menu bottom at the top) are just invisible, but they are clickable and do what they should. Reinstalling alone didn't help, but doing "Remove data" and "Clean cache" for that app solved the problem.

ShrikeV commented 4 years ago

I had same issue and confirm that "Remove data" and "Clean cache" solved the problem.

terryneal2 commented 4 years ago

I also had the same issue and just 'Remove data' fixed it. Thanks everyone.

mikehardy commented 4 years ago

That is so bizarre - great work figuring out a workaround but I can't for the life of me figure out why that would fix it? :thinking:

hiacre commented 4 years ago

Just to update on my experience - I didn't use the "remove data" option. Instead I reinstalled v2.13.5 which helped (not sure if that's equivalent to "remove data" or not). About 11 hours later, the problem returned. I've now downgraded to v2.13.0, and will do a minor version upgrade every couple of days to find out if there's a particular version where the problem cuts in.

One thing I noticed that might be helpful: when the problem returned, it exhibited itself slightly differently. I started a review, and the question appeared with no top menu bar at all. Then, within about a second, it flickered into visibility. That is, it seemed to rapidly disappear then reappear until it settled on being visible. After a few rounds of seeing this behaviour, it decided to stop showing itself altogether.

hiacre commented 4 years ago

New observation: after downgrading to v2.13.0, everything seemed fine for about 36 hours. When I started up AnkiDroid today, I was presented with the AnkiDroid Changelog screen which has a bar at the top (showing back button, and "AnkiDroid v2.13.5") and a bar at the bottom (showing the buttons "Rate AnkiDroid" and "Continue"). As I scroll up and down the changelog, the top and bottom bars flicker like crazy (the buttons in the bar at the bottom do NOT flicker). When I stop scrolling, there is about a 1 in 3 chance that both bars disappear (but the buttons at the bottom are still visible). I thought this was so similar to the reported problem that it was worth mentioning.

It appears I have been auto-upgraded to v2.13.5, I'm not sure if AnkiDroid did this itself or if the Google Play store did this. I'm positive I installed from the v2.13.0 APK... perhaps I was mistaken. EDIT: I was on v2.13.0 and was auto-upgraded by Google Play Store, have now turned off auto-updates.

mikehardy commented 4 years ago

Yeah, play store will auto-update you, which is normally exactly what you want. But not if attempting to isolate one version where things break of course :-)

david-allison commented 4 years ago

New observation: after downgrading to v2.13.0, everything seemed fine for about 36 hours. When I started up AnkiDroid today, I was presented with the AnkiDroid Changelog screen which has a bar at the top (showing back button, and "AnkiDroid v2.13.5") and a bar at the bottom (showing the buttons "Rate AnkiDroid" and "Continue"). As I scroll up and down the changelog, the top and bottom bars flicker like crazy (the buttons in the bar at the bottom do NOT flicker). When I stop scrolling, there is about a 1 in 3 chance that both bars disappear (but the buttons at the bottom are still visible). I thought this was so similar to the reported problem that it was worth mentioning.

Is there any possibility that you (or anyone) could send a video of this? Especially on the changelog/ Settings- Advanced - About AnkiDroid screen.

Are there any settings that you're changing before this appears (full screen for example), or does this appear seemingly at random?

hiacre commented 4 years ago

I've only ever seen the Changelog screen after launching the app after an update. Is there another way to view it? I'm not sure how useful the Settings->Advanced->About AnkiDroid screen will be, because all the text fits on the screen, so it's not possible to scroll up and down.

I didn't change any settings, as I'm happy with the defaults (I had no idea there was a fullscreen mode!) The weird behaviour starts up seemingly at random.

I attempted to reproduce just now by upgrading from v2.13.0 to v2.13.5. I saw flickering on the changelog screen as I scrolled up and down. The flickering was on the top bar, but no flickering on the bottom (possibly because it's a white bar on a white background - when I spotted this before, I was using Night Mode). I started up AZ Screen Recorder to take a video, but the act of doing this fixed the flickering problem. I'll have to find a second phone next time it happens.

It made me wonder whether it's related to overlay apps. I have a blue light filter installed, but it has worked fine with all other apps (and all other versions of AnkiDroid).

hiacre commented 4 years ago

I managed to grab a video of the flicker, after updating from v2.13.0 to v2.13.5.

https://www.dropbox.com/s/abznbno1bizgajf/AnkiDroid%20Issue%207369%20changelog%20flicker.mp4?dl=0

I turned on "Night mode", so that the bottom bar flickering could be seen as well. After I took this video, I attempted to use the AZ Screen Recorder again, but (again) doing that resolved the issue.

david-allison commented 4 years ago

Thanks for the video!

Could you download the 2.12 parallel release and confirm that the issue doesn't occur (especially if reports say it comes and goes after ~48 hours): https://github.com/ankidroid/Anki-Android/releases/download/v2.12.1/AnkiDroid-2.12.1.parallel.A.apk

The video implies to me that this is a hardware rendering issue, but, the fact that this occurred on a version upgrade implies that there may be something more to it.

I'll guess that it could potentially be one of the following updates:

    implementation 'com.google.android.material:material:1.2.0'
    implementation 'androidx.appcompat:appcompat:1.2.0'

Could you also test the Parallel.B of:

2.13alpha 9: https://github.com/ankidroid/Anki-Android/releases/tag/v2.13alpha9 2.13alpha 11: https://github.com/ankidroid/Anki-Android/releases/tag/v2.13alpha11 2.13alpha 13: https://github.com/ankidroid/Anki-Android/releases/tag/v2.13alpha13

and see if these do or don't exhibit this problem?

mikehardy commented 4 years ago

...been watching this (thanks for the video and reproduction efforts, sincerely!) and was thinking the same on those two dependency updates as "maybe"s

hiacre commented 4 years ago

I've been using the v2.12.1 parallel A release for 48 hours now, no sign of any problems. I'll move on to the v2.13 alphas next.

hiacre commented 4 years ago

I've been using parallel B of v2.13alpha9 for about 48 hours now, with no problems.

hiacre commented 4 years ago

I've been using parallel B of v2.13alpha11 for about 3 days now, with no problems. I'll move on to v2.13alpha13 next.

moksamedia commented 4 years ago

I've got the same problem here. LG G6, Android version 8.0.0. Had been working great for many months. Just broke recently.

david-allison commented 4 years ago

Hi @moksamedia

For now, could you download and use a parallel release of 2.12.1 to work around the problem: https://github.com/ankidroid/Anki-Android/releases/v2.12.1

It'd be useful if you could take some time to isolate the alpha release which introduced this bug. It's between 2.13.0 and 2.13alpha11: https://github.com/ankidroid/Anki-Android/releases?after=v2.13.0

We haven't been able to replicate this on our emulators, it seems to be physical-device only, so any help is appreciated.

hiacre commented 4 years ago

I've been using parallel B of v2.13alpha13 for 3 days now, and I haven't seen any sign of the problems. I'm going to start doing a binary split search across all the releases between v2.13alpha13 and v2.13.5.

david-allison commented 4 years ago

Can't reproduce this with the Samsung Galaxy Test Lab Samsung Galaxy S7

hiacre commented 3 years ago

I've been using v2.13.4 (parallel B) for 15 days now, and haven't seen any problems. From my perspective, it appears the problem was introduced in v2.13.5. However, the original reporter stated that they were able to reproduce in v2.13.0 and later. I suppose I could upgrade to v2.13.5, to find out whether:

  1. if the problem appears relatively soon (within a few days) - in this case I think that shows there's something between 2.13.4 and 2.13.5 that triggers the problem. The 2.13.4 -> 2.13.5 change could be the entire problem, or it could be exacerbating an existing problem introduced in an earlier version that does not exhibit itself on my phone.

    1. if the problem does not appear, then perhaps it was just a transient problem introduced in some unknown version, and fixed by reinstalling or wiping caches and app data.
github-actions[bot] commented 3 years ago

Hello ๐Ÿ‘‹, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

terryneal2 commented 3 years ago

Interestingly, I just had the same thing happen again, as I did on 10 October. Again clearing data and cache fixed it. I came back to this series of posts to find out what I needed to do, so please don't remove it from view.

clay53 commented 3 years ago

Came into this issue a few days ago. It started after I started using AwesomeTTS on linux and I was trying to find ways to get AnkiDroid/old TTS to work with it. When I first saw it, I thought it was just a bug with the new TTS tag for cards that used them but it's happening for all cards.

clay53 commented 3 years ago

I just went installed the latest version from master. It uninstalled and removed data (cards are still there though) but now it works. I'll try to debug it if it comes up again.

clay53 commented 3 years ago

I got the issue again. Here is the log from clicking the point of clicking the show answer button:

2021-01-22 13:38:53.749 6697-6697/com.ichi2.anki I/AbstractFlashcardViewer: AbstractFlashcardViewer:: Show answer button pressed
2021-01-22 13:38:53.750 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: displayCardAnswer()
2021-01-22 13:38:53.750 6697-6697/com.ichi2.anki D/InputMethodManager: HSIFW - flag : 0 Pid : 6697
2021-01-22 13:38:53.754 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: correct answer = ๅคงใใ‘ใ‚Œใฐ
2021-01-22 13:38:53.754 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: user answer = 
2021-01-22 13:38:53.755 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: updateCard()
2021-01-22 13:38:53.756 6697-6697/com.ichi2.anki D/Sound: expandSounds
2021-01-22 13:38:53.757 6697-6697/com.ichi2.anki V/AbstractFlashcardViewer: content card = 
     <div class="answer" id="qa"><style>.card {
     font-family: arial;
     font-size: 20px;
     text-align: center;
     color: black;
     background-color: white;
    }
    </style>Conjugate ๅคงใใ„ (ใŠใŠใใ„) with ใฐ

    <hr id=answer>

    <div><code id="typeans"><span class="typeMissed">ๅคงใใ‘ใ‚Œใฐ</span></code></div></div>
2021-01-22 13:38:53.757 6697-6697/com.ichi2.anki V/AbstractFlashcardViewer: ::style:: / @font-face {font-family: "OpenSans-Cond"; font-weight: bolder; font-style: normal; src: url("file:///android_asset/fonts/OpenSans-CondBold.ttf");}
    @font-face {font-family: "OpenSans"; font-weight: bolder; font-style: normal; src: url("file:///android_asset/fonts/OpenSans-Bold.ttf");}
    @font-face {font-family: "OpenSans"; font-weight: lighter; font-style: italic; src: url("file:///android_asset/fonts/OpenSans-LightItalic.ttf");}
    @font-face {font-family: "OpenSans"; font-weight: lighter; font-style: normal; src: url("file:///android_asset/fonts/OpenSans-Light.ttf");}
    @font-face {font-family: "OpenSans-Cond"; font-weight: lighter; font-style: normal; src: url("file:///android_asset/fonts/OpenSans-CondLight.ttf");}
    @font-face {font-family: "OpenSans-Extra"; font-weight: bolder; font-style: normal; src: url("file:///android_asset/fonts/OpenSans-ExtraBold.ttf");}
    @font-face {font-family: "OpenSans"; font-weight: normal; font-style: italic; src: url("file:///android_asset/fonts/OpenSans-Italic.ttf");}
    @font-face {font-family: "OpenSans-Regular"; font-weight: normal; font-style: normal; src: url("file:///android_asset/fonts/OpenSans-Regular.ttf");}
    @font-face {font-family: "OpenSans"; font-weight: bolder; font-style: italic; src: url("file:///android_asset/fonts/OpenSans-BoldItalic.ttf");}
    @font-face {font-family: "OpenSans-Cond"; font-weight: lighter; font-style: italic; src: url("file:///android_asset/fonts/OpenSans-CondLightItalic.ttf");}
    @font-face {font-family: "OpenSans-Extra"; font-weight: bolder; font-style: italic; src: url("file:///android_asset/fonts/OpenSans-ExtraBoldItalic.ttf");}
    BODY {font-family: 'OpenSans';font-weight: normal;font-style: normal;font-stretch: normal;}
2021-01-22 13:38:53.759 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: base url = file:///storage/emulated/0/AnkiDroid/collection.media/
2021-01-22 13:38:53.760 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: fillFlashcard()
2021-01-22 13:38:53.761 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer: base url = file:///storage/emulated/0/AnkiDroid/collection.media/
2021-01-22 13:38:54.244 6697-6697/com.ichi2.anki I/chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'xArrow' of undefined", source: file:///android_asset/mathjax/input/tex/extensions/mhchem.js (1)
2021-01-22 13:38:54.258 6697-6697/com.ichi2.anki I/chromium: [INFO:CONSOLE(1)] "MathJax localStorage error: Cannot read property 'getItem' of null", source: file:///android_asset/mathjax/tex-svg.js (1)
2021-01-22 13:38:54.278 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer$CardViewerWebClient: Java onPageFinished triggered: file:///storage/emulated/0/AnkiDroid/collection.media/__viewer__.html#answer
2021-01-22 13:38:54.279 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer$CardViewerWebClient: Java onPageFinished triggered: file:///storage/emulated/0/AnkiDroid/collection.media/__viewer__.html
2021-01-22 13:38:54.279 6697-6697/com.ichi2.anki D/AbstractFlashcardViewer$CardViewerWebClient: New URL, drawing flags, marks, and triggering JS onPageFinished: file:///storage/emulated/0/AnkiDroid/collection.media/__viewer__.html
mikehardy commented 3 years ago

I wonder if the javascript errors aren't causing the whole render to blow up somehow :thinking: ? They should not, but I don't know. This has been happening since 2.13 so I doubt that's it but, that's all I see in the log Thank you for posting the log though! Definitely good to see it

clay53 commented 3 years ago

From what I can tell, the issue is not related to animations, or a bug in the preview/review card subclass (both have bugs). I have no idea what the issue is though.

mikey-boy commented 3 years ago

Logs from a working version seem to be similar to the logs posted above, I can post those if someone wants to confirm.

It may be worth investigating why deleting data fixes the issue. Does anyone know what that actually removes? From what I can tell it doesn't touch anything in the AnkiDroid directory on my phone.

mikehardy commented 3 years ago

deleting data deletes temporary files used by the Android operating system to run the app, I believe it is in /data/data/android/com.ichi2.anki.ankidroid or similar (but I'm just guessing as I always use Android Studio's file system explorer to click-find my way in there)

mikey-boy commented 3 years ago

Yeah that seems to be correct. I will wait for the issue to reappear on my app to look at those files.

mikey-boy commented 3 years ago

The issue reappeared. I compared the data directory before the issue and after and these are the differences:

~/Desktop/anki-backup : diff broken-config config -r

Only in broken-config/app_webview/Default/blob_storage: 88b52e7b-a486-4692-a41f-0864a37b9ea3
Only in config/app_webview/Default/blob_storage: b32f4d6f-93ee-4496-a06a-11a111846111
Only in broken-config/app_webview/Default: Session Storage
Binary files broken-config/app_webview/webview_data.lock and config/app_webview/webview_data.lock differ

It might have to do with the new Session Storage directory. There's a log file in there, maybe this means something to someone:

2021/02/03-13:40:42.784 6ad8 Reusing MANIFEST /data/user/0/com.ichi2.anki/app_webview/Default/Session Storage/MANIFEST-000001

A bit of a shot in the dark I would say :P I'll try to debug the issue further

mikehardy commented 3 years ago

It does look like something is corrupt in session storage of broken-config, it would be interesting to dive more deeply into "blob_storage" to see what the contents are (if they are binary that is harder but you can use "asciidump" or "hexdump" or "strings" to pull info out) between the two configs.

mikey-boy commented 3 years ago

Well it's weird but those blob storage files are actually just empty directories. Here are the two configs if you want to look around: broken-config.zip config.zip

The db files differ (config/databases/ankidroid.db) because I changed my language settings.

mikey-boy commented 3 years ago

The problem seems to occur when updating the card (AbstractFlashCardView.java:2210). It seems that though the ease buttons are set to visible, the webview overlays these buttons and hides them. This is why we see a flicker after clicking show answer.

Can anyone explain to me how the webview is created alongside the other UI elements. It's also interesting to note that the "Show Answer" button is not overlapped but the ease buttons are.

mikehardy commented 3 years ago

@mikey-boy you may have just found the root cause! The show answer and ease buttons are native elements that are supposed to be below the WebView in standard layouts (that is: the default layout where user has not configured to hide any or all of those elements). I do not believe the WebView is supposed to overlap them

If this is the root cause (and it really seems like it) then there is probably some layout problem in the layout xml files where the WebView and ease buttons are colliding / overlapping incorrectly when they should not be

mikey-boy commented 3 years ago

Yup the problem seems to originate in src/main/res/layout/reviewer.xml. I'm not sure exactly why but if you change the layout_width of @layout/reviewer_flashcard to anything less than the width of the screen the problem fixes itself. Weird.

Unfortunately I'm not very familiar with android layouts. From what I can tell that file seems sane.

mikehardy commented 3 years ago

Fascinating again! Okay, well at least you/we are able to affect things by touching that file - always a strong indicator we sort of know what we're doing and we've found the place to do things. I'm not great at layouts either but I'm sure we/someone can bull through this now for a final fix. Thanks for investigating this it is a huge help!

jbuschtoens commented 3 years ago

I've had the same problem. Every time I showed a cards answer, the top bar and the answer buttons would flicker. Sometimes they were visible afterwards. Usually they were not. Once I had that same flicker in the top-bar while in the main menu (copying the debug info). Unistalling and deleting the AnkiDroid folder fixed the problem for me.

The one thing that seems to be different in my case is that the problem occurred after an update in January, not October.

AnkiDroid Version = 2.14.3 Android Version = 8.0.0 ACRA UUID = a695d433-b514-4943-89a4-6ca7a4b27652 Scheduler = std Crash Reports Enabled = true

mikehardy commented 3 years ago

Not surprised it is still happening - sorry there is still not a fix though with prior investigations it does appear we are very very close - it appears to be a layout error in the file (that I would presume then - via incorrect layout element overlapping - triggering a race condition that sometimes is lost, resulting in flicker / elements not showing etc)