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

Alert Failed to access the selected file. #7

Closed
TRSx80 opened this issue Mar 11, 2020 · 19 comments
Closed

Alert Failed to access the selected file. #7

TRSx80 opened this issue Mar 11, 2020 · 19 comments
Labels
bug Something isn't working

Comments

@TRSx80
Copy link

TRSx80 commented Mar 11, 2020

Hallo! Thanks for you work, and even more importantly, for sharing it! 🍻

I downloaded latest APK (v1.4.0) from Releases just now, synced it to my phone via Syncthing and installed it.

But when I try to open a beancount file, I got the error in the title. I tried opening first a previously existing (from cone) file.txt file, then I tried renaming it to file.beancount but that didn't work, either.

I guess I will try some other things now, but I just thought I would drop you a line. Are there any other requirements? Should the first line of the file maybe be a mode line as shown in the pictures on the home page for this project?

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

I just tried doing each of the following in turn, but got the same error as OP each time when trying to open file:

  • remove coding: utf-8; from mode line
  • remove fill-column: 250; from mode line
  • now my mode line is simply: ;; -*- mode: org; mode: beancount; -*-
  • remove all account lines I had in there like account Assets:Bank:Checking I had in there for cone auto complete to pick up on
  • add the following configuration lines:
option "title" "Test Beancount File"
option "operating_currency" "USD"
1970-01-01 custom "bcm_option" "transaction_flags" "['*', '!']"

Starting to run out of ideas...

@xuhcc
Copy link
Owner

xuhcc commented Mar 11, 2020

Hi!

But when I try to open a beancount file, I got the error in the title.

What kind of error do you see? Could you post a screenshot?

There are no specific requirements, you can open any text file in Beancount Mobile.

@bradyt
Copy link

bradyt commented Mar 11, 2020

@xuhcc
Copy link
Owner

xuhcc commented Mar 11, 2020

@bradyt

Yes, that's possible.

@TRSx80

Did the app ask you to grant the filesystem permission when you pressed the "Browse" button on the welcome screen? Also, what Android version you are running?

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

Wow, you guys are awesome. 😄 Thanks for super fast replies.

Here is a screenshot:
https://ibb.co/sC9fFtn

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

Did the app ask you to grant the filesystem permission when you pressed the "Browse" button on the welcome screen?

No, it did not. But I was able to browse, change folders, and select the file. Then that's when the error message popped up.

Also, what Android version you are running?

CyanogenMod version 12.1 (which is)
Android version 5.1.1

@bradyt
Copy link

bradyt commented Mar 11, 2020

If the device is running Android 5.1.1 (API level 22) or lower, or the app's targetSdkVersion is 22 or lower while running on any version of Android, the system automatically asks the user to grant all dangerous permissions for your app at install-time (see figure 2).

https://developer.android.com/guide/topics/permissions/overview

@TRSx80, maybe you have to enable the permissions manually, like so:

For apps you've already downloaded
Use the Settings app on your device:

On your device, open your device's Settings app Settings app.
Tap Apps or Application Manager (depending on your device, this may be different).
Select an app.
Scroll down to "Permissions."

https://support.google.com/googleplay/answer/6014972?co=GENIE.Platform%3DAndroid&oco=1

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

the system automatically asks the user to grant all dangerous permissions for your app at install-time

Oh wait, I forgot, the Package Installer did ask for those permissions during installation!

If I go in Settings -> Apps -> Beancount Mobile, and then scroll to the bottom, then yes I can confirm:

This app can access the following on your phone:
modify or delete the contents of your SD card
read the contents of your SD card

@xuhcc
Copy link
Owner

xuhcc commented Mar 11, 2020

I tried to run the app in simulator and can confirm that it doesn't open the file on Android 5.1

@xuhcc
Copy link
Owner

xuhcc commented Mar 11, 2020

I think it has something to do with the file picker library that we use.

It can't pick the file from "SD card" location, but I was able to pick it from "Downloads" folder.

@TRSx80 Alternatively, you can type/paste the path to the file directly into the input field on "Welcome" screen. However, I've noticed yet another bug: the side drawer is not working.

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

you can type/paste the path to the file directly into the input field on "Welcome" screen.

OK, that actually worked! 😄 🎆

As soon as I typed the last letter of the correct file name, the "CONTINUE" button turned yellow, and I was able to press it, and my file opened!

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

the side drawer is not working.

You mean the left side? It seems to work for me. To clarify, this is the functionality I get:

  • slides out from left
    • via swipe motion
    • and via pancake menu button
  • pressing "Settings" opens Settings screen (although not much in there)
  • pressing "About" opens about screen
  • pressing "File content" brings me back to my file

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

OK, but yeah, I can't seem to open / change file from the side menu. Is that what you meant?

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

OK, further testing: I just tried to enter a transaction, I was able to enter everything (nice drop downs and completion, btw!) but then I couldn't save which I suppose I'm not surprised. Disk icon at top right maybe greyed out? I pressed 3x and no result. But my file is very big, and the app seemed a little slow. I did wait a while though because of this. Let me try again with a smaller file.

@TRSx80
Copy link
Author

TRSx80 commented Mar 11, 2020

OK, so this is weird. I was able to enter (and save) the transaction in my "smaller" file. Confirmed saved and synced back to my desktop here (the file is in a Syncthing folder). I opened it up back here on my desktop, and I can see the new transaction at the bottom.

So, what are differences between "big file" and "small file"?

  • big file is 344K, little file is 1.1K
  • I was trying to enter an Income transaction (negative amount on "From" account)

Let me know if there is anything else you want me to test.

Also, would you like me to move this last bit into a new issue?

Thanks guise!

With these workarounds, I think this will already be usable for me! Cheers! 🍻

@xuhcc
Copy link
Owner

xuhcc commented Mar 11, 2020

OK, but yeah, I can't seem to open / change file from the side menu.

You should be able to change it on the 'Settings' page.

Disk icon at top right maybe greyed out?

This means that some of the required fields are not filled (date, amount, currency, account 1, account 2) or that their values are not valid. Beancount Mobile doesn't show error messages yet, but I think it could be wrong amount (it must be positive and without spaces).

The size shouldn't matter much. My beancount file is 279K and everything works smoothly.

Also, would you like me to move this last bit into a new issue?

Yes, let's start a new issue if the problem persists. 👍

@xuhcc xuhcc added the bug Something isn't working label Mar 14, 2020
xuhcc added a commit that referenced this issue Mar 14, 2020
@xuhcc
Copy link
Owner

xuhcc commented Mar 14, 2020

The issue with filepicker library is probably not going to be fixed, so I just added a notice to the readme that Android 6.0 or later is recommended.

@xuhcc xuhcc closed this as completed Mar 14, 2020
@evgeni
Copy link

evgeni commented Jul 30, 2020

FWIW, I have the same issue on Android 10 on my Pixel 4. Opening from Downloads works, same file from Documents/beancount (which is where I sync it to via Syncthing) does not.

@xuhcc
Copy link
Owner

xuhcc commented Jul 31, 2020

@evgeni Yes, I noticed this bug too. Unfortunately I don't have a solution at the moment (it seems to be an issue with filepicker library).

I created a separate issue for it: #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants