juanro49 / autu-mandu

Autu Mandu te permite controlar ingresos y gastos de tus vehículos y mostrarlos en bonitos informes.
Apache License 2.0
16 stars 0 forks source link

Cannot export backups, neither CSV #4

Open efraletti opened 1 year ago

efraletti commented 1 year ago

backup fails with message "Erro: O backup falhou"

export CSV fails with message: "Erro: a exportação falhou. Motivo: Could not create export directory"

setting "backup path" is set to blank. trying to set it to various paths did nothing to suppress the above messages.

i created the folder "/storage/emulated/0/Autu Mandu CSV" and even a blank file called car.csv, but the error persists, as "open failed: EACCESS (permission denied)", even though the app has storage persmissions on system config.

I intended to export a simple CSV with one record of each type to see the data format and create a CSV with my data that I have in spreadsheet format.

I could help with code but java is not my strength. thank you and looking forward to having this robust app in the tool belt for many years to come

essys commented 1 year ago

I try to achieve the same: exporting some basic example entries to get hands on the data structure and later to prepare an export out of aCar to then import it into Autu Mandu.

Unfortunately I cannot export in Autu Mandi. Hitting the export menu item does nothing, no error no file no nothing.

juanro49 commented 1 year ago

Can you try with new 4.0.1 version? https://github.com/juanro49/autu-mandu/releases

efraletti commented 1 year ago

Unfortunately, the error persiats, even after a clean install, wiping app data and cache, and giving storage permission when asked (and checking it is indeed given on the system app info).

I'm on Android 10, if it helps.

Thanks

essys commented 1 year ago

Similar results over here. Nothing happens after clicking 'Export CSV'. Exactly the same happens while clicking 'Backup' or 'Restore' buttons.

Can I help with troubleshooting this issue somehow?

juanro49 commented 1 year ago

You must manually set the "Allow to manage all files" option in the permissions settings. By setting permissions to access the file system when prompted, it only grants permissions to access media content, which is not a valid option for the backup to work. Captura_20230906_001

essys commented 1 year ago

It's greyed out, I cannot grant any permissions. Screenshot_20230906-185313_Settings

juanro49 commented 1 year ago

It's greyed out, I cannot grant any permissions. Screenshot_20230906-185313_Settings

oh... What's your android version?

essys commented 1 year ago

Pixel 5 on iodéOS 4.4 (fork of LineageOS 20), so it is Android 13.

juanro49 commented 1 year ago

Pixel 5 on iodéOS 4.4 (fork of LineageOS 20), so it is Android 13.

I try this in virtual device and you are right. In Android 13 and upper we cannot grant any permissions. I have to check the new permissions requirements of the new Android versions to correct this.

juanro49 commented 1 year ago

Hi!

I have released a new version which should have solved the problem https://github.com/juanro49/autu-mandu/releases

essys commented 1 year ago

Now while entering the 'Backup & Export" settings, the settings closes and the app jumps back to the main screen. Repeating this steps the app crashes.

efraletti commented 1 year ago

for me it works, export it writes the files and I could see the CSV format, now to convert some spreadsheets and try to import my last 5 years of data for my vehicles and set some reminders

juanro49 commented 1 year ago

Now while entering the 'Backup & Export" settings, the settings closes and the app jumps back to the main screen. Repeating this steps the app crashes.

In previous version, you have backup target option empty o with content?

can you put the log when app crash?

adb logcat -v color | grep -F "`adb shell ps | grep autumandu  | tr -s [:space:] ' ' | cut -d' ' -f2`"
essys commented 1 year ago

Now while entering the 'Backup & Export" settings, the settings closes and the app jumps back to the main screen. Repeating this steps the app crashes.

In previous version, you have backup target option empty o with content?

can you put the log when app crash?

adb logcat -v color | grep -F "`adb shell ps | grep autumandu  | tr -s [:space:] ' ' | cut -d' ' -f2`"

After last tests I am pretty sure it contained some content.

Logcat:

$ adb logcat -v color | grep -F "`adb shell ps | grep autumandu  | tr -s [:space:] ' ' | cut -d' ' -f2`"
09-14 20:25:45.629  1932  1968 D ActivityManager: quick sync unfreeze 20308
09-14 20:25:45.635  1932  2243 D ActivityManager: sync unfroze 20308 org.juanro.autumandu
09-14 20:25:45.640 20308 20330 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference
09-14 20:25:45.652 20308 20326 E OpenGLRenderer: Unable to match the desired swap behavior.
09-14 20:25:50.357 20308 20308 W OnBackInvokedCallback: OnBackInvokedCallback is not enabled for the application.
09-14 20:25:50.357 20308 20308 W OnBackInvokedCallback: Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
09-14 20:25:51.211 20308 20308 D CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10316; state: ENABLED
09-14 20:25:51.225 20308 20326 W Parcel  : Expecting binder but got null!
09-14 20:25:51.239 20308 20326 E OpenGLRenderer: Unable to match the desired swap behavior.
09-14 20:25:52.788 20308 20308 D AndroidRuntime: Shutting down VM
09-14 20:25:52.789 20308 20308 E AndroidRuntime: FATAL EXCEPTION: main
09-14 20:25:52.789 20308 20308 E AndroidRuntime: Process: org.juanro.autumandu, PID: 20308
09-14 20:25:52.789 20308 20308 E AndroidRuntime: java.lang.IllegalArgumentException: Invalid URI: /storage/emulated/0/AutuMandu
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.provider.DocumentsContract.getTreeDocumentId(DocumentsContract.java:1289)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at n2.b.l(SourceFile:1)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at s0.a.c(SourceFile:10)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at k5.b.a(SourceFile:55)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at org.juanro.autumandu.gui.PreferencesBackupFragment.h(SourceFile:1)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at org.juanro.autumandu.gui.PreferencesBackupFragment.onCreate(SourceFile:171)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.Fragment.performCreate(Fragment.java:2486)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1261)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2431)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2210)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2166)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2067)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.FragmentManagerImpl$1.run(FragmentManager.java:742)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:942)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:99)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.os.Looper.loopOnce(Looper.java:201)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:288)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7924)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
09-14 20:25:52.812 20308 20308 I Process : Sending signal. PID: 20308 SIG: 9
09-14 20:25:52.857  1932  9986 I ActivityManager: Process org.juanro.autumandu (pid 20308) has died: fg  TOP 
09-14 20:25:52.857  1001  1001 I Zygote  : Process 20308 exited due to signal 9 (Killed)
09-14 20:25:52.857  1932  2312 I libprocessgroup: Successfully killed process cgroup uid 10316 pid 20308 in 0ms
09-14 20:25:5EDIT: Sorry I am not sure how to format the code properly.2.960  1932  2244 I Process : Sending signal. PID: 20308 SIG: 9
09-14 20:25:52.961  1932  2243 W ActivityManager: setHasOverlayUi called on unknown pid: 20308
juanro49 commented 1 year ago

Now while entering the 'Backup & Export" settings, the settings closes and the app jumps back to the main screen. Repeating this steps the app crashes.

In previous version, you have backup target option empty o with content? can you put the log when app crash?

adb logcat -v color | grep -F "`adb shell ps | grep autumandu  | tr -s [:space:] ' ' | cut -d' ' -f2`"

After last tests I am pretty sure it contained some content.

Logcat:

$ adb logcat -v color | grep -F "`adb shell ps | grep autumandu  | tr -s [:space:] ' ' | cut -d' ' -f2`"
09-14 20:25:45.629  1932  1968 D ActivityManager: quick sync unfreeze 20308
09-14 20:25:45.635  1932  2243 D ActivityManager: sync unfroze 20308 org.juanro.autumandu
09-14 20:25:45.640 20308 20330 W DocumentFile: Failed query: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference
09-14 20:25:45.652 20308 20326 E OpenGLRenderer: Unable to match the desired swap behavior.
09-14 20:25:50.357 20308 20308 W OnBackInvokedCallback: OnBackInvokedCallback is not enabled for the application.
09-14 20:25:50.357 20308 20308 W OnBackInvokedCallback: Set 'android:enableOnBackInvokedCallback="true"' in the application manifest.
09-14 20:25:51.211 20308 20308 D CompatibilityChangeReporter: Compat change id reported: 171228096; UID 10316; state: ENABLED
09-14 20:25:51.225 20308 20326 W Parcel  : Expecting binder but got null!
09-14 20:25:51.239 20308 20326 E OpenGLRenderer: Unable to match the desired swap behavior.
09-14 20:25:52.788 20308 20308 D AndroidRuntime: Shutting down VM
09-14 20:25:52.789 20308 20308 E AndroidRuntime: FATAL EXCEPTION: main
09-14 20:25:52.789 20308 20308 E AndroidRuntime: Process: org.juanro.autumandu, PID: 20308
09-14 20:25:52.789 20308 20308 E AndroidRuntime: java.lang.IllegalArgumentException: Invalid URI: /storage/emulated/0/AutuMandu
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.provider.DocumentsContract.getTreeDocumentId(DocumentsContract.java:1289)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at n2.b.l(SourceFile:1)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at s0.a.c(SourceFile:10)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at k5.b.a(SourceFile:55)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at org.juanro.autumandu.gui.PreferencesBackupFragment.h(SourceFile:1)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at org.juanro.autumandu.gui.PreferencesBackupFragment.onCreate(SourceFile:171)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.Fragment.performCreate(Fragment.java:2486)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1261)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.FragmentManagerImpl.addAddedFragments(FragmentManager.java:2431)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2210)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2166)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2067)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.FragmentManagerImpl$1.run(FragmentManager.java:742)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.os.Handler.handleCallback(Handler.java:942)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.os.Handler.dispatchMessage(Handler.java:99)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.os.Looper.loopOnce(Looper.java:201)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.os.Looper.loop(Looper.java:288)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at android.app.ActivityThread.main(ActivityThread.java:7924)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at java.lang.reflect.Method.invoke(Native Method)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
09-14 20:25:52.789 20308 20308 E AndroidRuntime:  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
09-14 20:25:52.812 20308 20308 I Process : Sending signal. PID: 20308 SIG: 9
09-14 20:25:52.857  1932  9986 I ActivityManager: Process org.juanro.autumandu (pid 20308) has died: fg  TOP 
09-14 20:25:52.857  1001  1001 I Zygote  : Process 20308 exited due to signal 9 (Killed)
09-14 20:25:52.857  1932  2312 I libprocessgroup: Successfully killed process cgroup uid 10316 pid 20308 in 0ms
09-14 20:25:5EDIT: Sorry I am not sure how to format the code properly.2.960  1932  2244 I Process : Sending signal. PID: 20308 SIG: 9
09-14 20:25:52.961  1932  2243 W ActivityManager: setHasOverlayUi called on unknown pid: 20308

It's because previous version of backup target has content (/storage/emulated/0/AutuMandu).

In the next few days I will try to add a fix so that if the route is invalid, it will default to the default route instead of crashing.

For the moment, if you have a backup, you can delete data from the app and restore it, or if you have root, you can edit the /data/data/org.juanro.autumandu/shared_prefs/org.juanro.autumandu_preferences.xml file leaving the backup_folder key empty.

essys commented 1 year ago

You are right, this worked. I removed the backup_folder string in preferences.xml as root and now I can access the export settings again. Also exporting a CSV and the db worked just fine. Thank you very much for the support. Now I can also try to craft a new CSV with old data from the past to reimport it later.