codinguser / gnucash-android

Gnucash for Android mobile companion application.
Apache License 2.0
1.23k stars 539 forks source link

Export destination is always "SD Card" #357

Closed agalanin closed 9 years ago

agalanin commented 9 years ago
  1. Open the application
  2. Create some transactions
  3. Select Menu -> "Export transactions..."
  4. Select "Share file..." as export destination and press "Export"
  5. Check export destination

Expected result:

  1. Share file menu is displayed

Actual results:

  1. "Exported to : SD card" message displayed
  2. New file is created under /mnt/sdcard/org.gnucash.android/exports
nodje commented 9 years ago

same issue here

codinguser commented 9 years ago

I'm not able to replicate this so far. What Android version are you running?

agalanin commented 9 years ago

On Tue, 18 Aug 2015 00:47:31 -0700 Ngewi Fet notifications@github.com wrote:

I'm not able to replicate this so far. What Android version are you running?

Android 2.3.6

Alexander Galanin

nodje commented 9 years ago

Android 5.0.2 The problem did not occur prior to the two last updates (before 1.5.0?) I will post a log trace when I can find the time.

floriankisser commented 9 years ago

Same here on CyanogenMod 11 (Android 4.4.4) with gnucash from f-droid. Last export that worked for me was on 07 July, first that didn't on 17 July (don't know the gnucash versions, sry).

lennartS commented 9 years ago

Same here on Android 4.2.2 (Fairphone OS). Pretty sure it's broken for me since version 1.6.1.

agalanin commented 9 years ago

I am unable to export transactions via E-mail in version 2.0.0-beta1 too:

  1. select Menu->Export...
  2. export to: "send to..."
  3. select "export all transactions" and QIF format
  4. click "export" Expected results:
  5. export menu is displayed Actual result:
  6. "exported to: external service" message is displayed, new file is created under /sdcard/org.gnucash.android/exports.
codinguser commented 9 years ago

Thanks for the reports @nodje @floriankisser @lennartS @agalanin
Could you also let me know what your device locale is set to?

lennartS commented 9 years ago

Under „Language & input“ English is set as Language. If you mean a different locale setting, please let me know how to find it and I'll happily supply it.

floriankisser commented 9 years ago

de_at. Android 5.1.1 works neither.

codinguser commented 9 years ago

no, that's the one. Thanks

On Sun, Oct 4, 2015 at 12:52 AM, lennartS notifications@github.com wrote:

Under „Language & input“ English is set as Language. If you mean a different locale setting, please let me know how to find it and I'll happily supply it.

— Reply to this email directly or view it on GitHub https://github.com/codinguser/gnucash-android/issues/357#issuecomment-145296120 .

agalanin commented 9 years ago

Problem is reproducible with both Russian and English (US) locales.

codinguser commented 9 years ago

Please send me more details about your device, Android version, rooted or not, etc.

I'm trying to find what the common denominator is for the devices where it doesn't work.

On my device, I get the toast "Exported to external service" and then the list of apps opens to choose from.

On Sunday, 4 October 2015, Alexander Galanin notifications@github.com wrote:

Problem is reproducible with both Russian and English (US) locales.

— Reply to this email directly or view it on GitHub https://github.com/codinguser/gnucash-android/issues/357#issuecomment-145366446 .

agalanin commented 9 years ago

On Mon, 05 Oct 2015 00:30:39 -0700 Ngewi Fet notifications@github.com wrote:

Please send me more details about your device, Android version, rooted or not, etc.

Android 2.3.6, Samsung GT-S6102, rooted

Alexander Galanin

richardinside commented 9 years ago

Same here. Gnucash version 1.6.3 installed from F-Droid. Version 1.6.1 does not work too. Samsung Galaxy S2, Android 4.2.2, Cyanogen mod

Export to other sources (for example Owncloud) worked in older versions of Gnucash (maybe 1.5.*, but I'm not sure, and they are absent at F-Droid, so I cannot check which one works).

codinguser commented 9 years ago

ok, so far, the thing in common I see is Android devices with custom images (either rooted or Cyanogen). @lennartS @floriankisser @nodje what about your devices?

floriankisser commented 9 years ago

Moto G 2013 xt1032, rooted, was on cyanogenmod 11 at first occurence and didn't update for a long time before that. Now I'm on cyanogenmod 12.1. Mail client that should open is k-9 mail btw.

agalanin commented 9 years ago

Export to other sources (for example Owncloud) worked in older versions of Gnucash (maybe 1.5.*, but I'm not sure, and they are absent at F-Droid, so I cannot check which one worked).

Try to add F-Droid archive repository ( https://f-droid.org/archive ).

Alexander Galanin

richardinside commented 9 years ago

"Send file" works in old Gnucash version 1.5.5 from F-Droid archive repository. So something have been broken since that version.

One difference I have noticed between these two versions, is that default export option in version 1.5.5 is "Send file", but in version 1.6.3 is "SD Card". So it is possible that interface of changing this option in new versions just does not work.

PS: I also tried Gnucash version 1.6.3 on Android 5.1.1 Lollipop, Cyanogen mod, and this feature fails to work too.

lennartS commented 9 years ago

@codinguser I use FairPhone OS on a rooted device. GnuCash is installed via f-droid with K-9 mail as intended export target.

alpha-and-omega commented 9 years ago

It works in current Beta.

agalanin commented 9 years ago

On Sat, 10 Oct 2015 06:49:22 -0700 alpha-and-omega notifications@github.com wrote:

It works in Beta. I think you guys just should wait for an update.

Doesn't work for me in version 2.0.0-beta3.

codinguser commented 9 years ago

This issue is not consistently reproducible. Also I don't have a rooted or Cyanogen device to test, so it is difficult to pinpoint the problem. But I'll keep looking

lennartS commented 9 years ago

@codinguser I can install a debug version next to the real thing if I choose a different certificate, right? I might be able to install a debug version and look for the cause of this bug, if you give me some pointers where to start.

codinguser commented 9 years ago

@lennartS if you checkout the code and run gradle iDD you will install a development version on your device. Your existing data will not be affected. See the README for more detailed instructions

rivaldi8 commented 9 years ago

I'm not sure, but I may having the same issue. In my case, however, the device isn't rooted and nothing gets writen to the SD card.

I've been debugging trying to figure out what is going on. I'll try to explain. Sorry, if it's a bit disperse.

What I'm seeing is that ExportAsyncTask.copyExportToSDCard() creates two files:

src = /data/data/org.gnucash.android.devel/files/20151019_190813_gnucash_export.qif
dst = /storage/emulated/0/org.gnucash.android.devel/exports/20151019_200858_gnucash_export.qif

dst path is supposed to point to the SD card, however it's actually writing to the internal storage. Nevertheless, I think it shouldn't be a problem, just curious.

Next copyFile(src, dst) is called, which in turn calls splitQIF(src, dst). The latter creates 20151019_200858_gnucash_export_EUR.qif in the export directory (dst), but the list of files it returns is ignored.

Then, back at ExportAsyncTask, it calls shareFile(), but with output=dst as path instead of the one ended in "_EUR.qif" created by splitQIF(). As a consequence, shareFile() fails to open it:

E/ExportAsyncTask: Error split up files in shareFile. /storage/emulated/0/org.gnucash.android.devel/exports/20151019_211545_gnucash_export.qif: open failed: ENOENT (No such file or directory)

I haven't looked further into it, but I'd say the problem is the reuse of copyExportToSDCard(). Both copyExportToSDCard() and shareFile() call splitQIF(), but the latter is expecting the unsplited file.

My device is a bq Aquaris E4 with Android 5.0.

rivaldi8 commented 9 years ago

I've been working on a fix, without luck yet though. Now it opens the share intent, but nothing is attached when I choose to send it by email.

I won't be able to work on it again until Thursday. In case someone wants to take a look meanwhile, here's what I've done so far:

https://github.com/rivaldi8/gnucash-android/tree/bugfix-357-export-always-sd-card

codinguser commented 9 years ago

@fefe982 could you look into this?

rivaldi8 commented 9 years ago

It turns out it was already fixed. Somehow I ended up without any transaction, so there was nothing to attach :P

I've sent a pull request, but someone should test it first to ensure it's been really fixed and that nothing has been broken. It'd also be nice if someone could run the tests. As always, I can't make them run.

codinguser commented 9 years ago

Hey everyone, please test the latest beta (v2.0.0-beta5) and let me know if this issue if fixed for you. If you're not in the beta program, join here: https://play.google.com/apps/testing/org.gnucash.android

agalanin commented 9 years ago

Hey everyone, please test the latest beta and let me know if this issue if fixed for you.

  1. Export destination is "SD card" by default. I think that application should remember last selected combobox item.
  2. Export via external service is working now.
rivaldi8 commented 9 years ago

Thanks for the testing @agalanin! I've opened a new issue (#408) for remembering the last export destination.