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

Access to shared dictdata directory will stop starting Android 12 (maybe) #29

Open
kmadathil opened this issue Oct 22, 2020 · 10 comments
Open

Comments

@kmadathil
Copy link

Phone: Moto G Stylus
Android Version: 10

Final step displays "Failed on: all files"

Log seems to be unavailable - I cannot share it with email ("Couldn't attach file"), WhatsApp or Bluetooth.
I have tried

  • Changing the number of dictionaries downloaded (fails for 1 file, or any number)
  • Reinstalled program
  • Cleared Cache and Storage.
@vvasuki
Copy link
Member

vvasuki commented Oct 23, 2020

It's odd. I got one or two reports in the past couple of days. Not sure what the problem is. Can't replicate on my phone.

@kmadathil
Copy link
Author

kmadathil commented Oct 23, 2020

I have worked around using a fork of pydictupdater at https://github.com/kmadathil/pydictupdater - updated to work with Python3 and the new repository structure.
May be of use to someone else who's similarly stuck. This is a very minimal python solution; it requires you to know how python works, and have a passing familiarity with the structure of indic-dicts, so it is not a sufficient workaround for a general user.

@vvasuki
Copy link
Member

vvasuki commented Oct 24, 2020

@kmadathil - I've made you maintainer of https://github.com/sanskrit-coders/pydictupdater and given you write access to this repo. Can you merge back your changes there (and perhaps even debug this repo for your case)?

@kmadathil
Copy link
Author

I've merged my pydictupdater changes. It can be improved if someone actually shows interest in using it.

@vvasuki
Copy link
Member

vvasuki commented Nov 2, 2020

@kmadathil Can you update to 3.4.5 (should be out tomorrow), rerun, and send me the log (final button)?

@kmadathil
Copy link
Author

Done. You should have the log in your mailbox

@vvasuki
Copy link
Member

vvasuki commented Nov 6, 2020

Done. You should have the log in your mailbox

11-05 20:31:49.570 22797 22797 E ArchiveDownloader: java.lang.AssertionError: Cannot create parent directories for requested File location
...
11-05 20:31:49.570 22797 22797 E ArchiveDownloader: 	at sanskritCode.downloaderFlow.ArchiveDownloader$downloadArchive$1.<init>(ArchiveDownloader.kt:67)

Strange - why can't it create the parent directories while downloading? Luckily I can replicate it with a simulated android 10 device. Will look into it.

@kmadathil
Copy link
Author

kmadathil commented Nov 6, 2020

My previous device was Android 10 as well, but it may have been upgraded from 9 to 10 after the first download. It is likely then that directory creation is the root cause.

@vvasuki
Copy link
Member

vvasuki commented Nov 7, 2020

Problem is that from Android 10, an app cannot have direct access to arbitrary shared directories. Instead, app needs to let the user pick a directory via "Storage Access Framework", or "provide" files of a certain mimetype. I am not sure how various dict apps will adjust to this (probably not a big deal since they need mostly read access) - but will wait and see.

Short term solution

For now, I've just postponed the problem to Android 12.

As https://stackoverflow.com/questions/58379543/cant-create-directory-in-android-10 says:

For Android 10 and 11, you can add android:requestLegacyExternalStorage="true" to your element in the manifest. This opts you into the legacy storage model, and your existing external storage code will work.

The temp fix should roll out to production in a day or two.

Long term solution

Copying 100s/ 1000s of files to user-selected external directory via "Storage Access Framework" will be quite irritating - hopefully someone will publish a good code snippet in the next year.

If that does not work, I will consider just junking this app and going the python route (those poor users who are not tech-savvy will unfortunately have to get by).

@vvasuki vvasuki changed the title Unable to run on Moto G Stylus Access to shared dictdata directory will stop starting Android 12 Nov 7, 2020
@vvasuki vvasuki reopened this Nov 11, 2020
@vvasuki vvasuki changed the title Access to shared dictdata directory will stop starting Android 12 Access to shared dictdata directory will stop starting Android 12 (maybe) Nov 11, 2020
@vvasuki
Copy link
Member

vvasuki commented Nov 11, 2020

" temporarily opt out of the changes associated with scoped storage " says https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage . No idea when the blade will fall - may be later than android 12.

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

No branches or pull requests

2 participants