Open MadFisa opened 2 months ago
I am also facing similar problem. When I try to open the .gnucash file created with Gnucash for desktop, Gnucash Pocket just stays in the importing popup. It never completes. When I tap anywhere on the screen the popup just disappears, without any error message.
I just found that, the gnucash file format I had for the desktop was gzipped XML file. I switched to SQLite3 backend and this file fails with the message "An error occurred while opening the GnuCash accounts", as mentioned in this issue.
did you try to use not gzipped XML file?
@Kaligula0 I'm not using a gzipped version, just a plain old .gnucash file.
Is there a way to debug this further through adb or something? I'm ready to dig around figure out what is causing this, but I have no experience with android apps. Currently only information on failure to read is just a pop up saying "An error occured while opening the GnuCash accounts", which is not much.
Just an update, I have set up android studio and is able to build the app and run it. How to proceed further?
@djbrown @Kaligula0 So I managed to get the logs, Turns out the problem is probably caused by the custom commodities that I made. Not sure what is the cause though. I am attaching the log file.
Thank you for providing the log. The following errors remind me of #156:
D Start import
I Creating database tables
I Bulk adding 224 Commodity records to the database
E Commodity not found in the database: ASIANPAINT
E Commodity not found in the database: HDFC_MIDC_OPPO_UP4UI9
E Commodity not found in the database: ICIC_PRU_TECH_1027WGP
E Commodity not found in the database: NIPP_INDI_LARG_COGPO7
E Commodity not found in the database: NIPP_INDI_SMAL_1AOBL3E
E Commodity not found in the database: PGIM_INDI_ELSS_156PSD9
E Commodity not found in the database: template
E Commodity not found in the database: QUAN_ELSS_TAX_KBGFAS
And the following exception comes from here: https://github.com/GnuCash-Pocket/gnucash-android/blob/d3af73d6460c728746c42ee08ef3bc709b5a264d/app/src/main/kotlin/org/gnucash/android/model/Money.kt#L320-L324
Error importing: content://com.android.providers.downloads.documents/document/3881
org.gnucash.android.model.Money$CurrencyMismatchException: Cannot perform operation on Money instances with different currencies
at org.gnucash.android.model.Money.minus(Money.kt:324)
at org.gnucash.android.model.Transaction.getImbalance(Transaction.kt:239)
at org.gnucash.android.model.Transaction.createAutoBalanceSplit(Transaction.kt:130)
at org.gnucash.android.importer.GncXmlHandler.endElement(GncXmlHandler.java:680)
at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:167)
at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method)
at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:526)
at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:487)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:324)
at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:287)
at org.gnucash.android.importer.GncXmlImporter.parse(GncXmlImporter.java:70)
at org.gnucash.android.importer.ImportAsyncTask.doInBackground(ImportAsyncTask.java:84)
at org.gnucash.android.importer.ImportAsyncTask.doInBackground(ImportAsyncTask.java:44)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
@MadFisa can you give minimum steps to reproduce the problem from scratch, or even better provide an automated unit or instrumentation-test? also @pnemonic78 could you look into this?
Can you attach the problematic file?
On Wed, 3 Jul 2024, 22:58 Daniel Brown, @.***> wrote:
Thank you for providing the log. The following errors remind me of #156 https://github.com/GnuCash-Pocket/gnucash-android/pull/156:
D Start import I Creating database tables I Bulk adding 224 Commodity records to the database E Commodity not found in the database: ASIANPAINT E Commodity not found in the database: HDFC_MIDC_OPPO_UP4UI9 E Commodity not found in the database: ICIC_PRU_TECH_1027WGP E Commodity not found in the database: NIPP_INDI_LARG_COGPO7 E Commodity not found in the database: NIPP_INDI_SMAL_1AOBL3E E Commodity not found in the database: PGIM_INDI_ELSS_156PSD9 E Commodity not found in the database: template E Commodity not found in the database: QUAN_ELSS_TAX_KBGFAS
And the following exception comes from here:
Error importing: content://com.android.providers.downloads.documents/document/3881 org.gnucash.android.model.Money$CurrencyMismatchException: Cannot perform operation on Money instances with different currencies at org.gnucash.android.model.Money.minus(Money.kt:324) at org.gnucash.android.model.Transaction.getImbalance(Transaction.kt:239) at org.gnucash.android.model.Transaction.createAutoBalanceSplit(Transaction.kt:130) at org.gnucash.android.importer.GncXmlHandler.endElement(GncXmlHandler.java:680) at org.apache.harmony.xml.ExpatParser.endElement(ExpatParser.java:167) at org.apache.harmony.xml.ExpatParser.appendBytes(Native Method) at org.apache.harmony.xml.ExpatParser.parseFragment(ExpatParser.java:526) at org.apache.harmony.xml.ExpatParser.parseDocument(ExpatParser.java:487) at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:324) at org.apache.harmony.xml.ExpatReader.parse(ExpatReader.java:287) at org.gnucash.android.importer.GncXmlImporter.parse(GncXmlImporter.java:70) at org.gnucash.android.importer.ImportAsyncTask.doInBackground(ImportAsyncTask.java:84) at org.gnucash.android.importer.ImportAsyncTask.doInBackground(ImportAsyncTask.java:44) at android.os.AsyncTask$3.call(AsyncTask.java:394) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644) at java.lang.Thread.run(Thread.java:1012)
@MadFisa https://github.com/MadFisa can you give minimum steps to reproduce the problem from scratch, or even better provide an automated unit or instrumentation-test? also @pnemonic78 https://github.com/pnemonic78 could you look into this?
— Reply to this email directly, view it on GitHub https://github.com/GnuCash-Pocket/gnucash-android/issues/158#issuecomment-2207119648, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB3GXCXYGT3ES3T7H6CPQNDZKRJWPAVCNFSM6AAAAABJVU7UHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBXGEYTSNRUHA . You are receiving this because you were mentioned.Message ID: @.***>
Hi, @pnemonic78 @djbrown sorry for the late reply. I'm not a developer by trade, so I don't know how to setup automated tests.
I'm happy to share the file, I have uploaded the file in the following link.
https://drive.google.com/file/d/11iNqXt07zR0r_N7Fk8774r9D1dR5cgLb/view?usp=sharing
Let me know when you try to access the file. I will have to accept the request.
My laptop is fried, so I'm unable to reproduce the situation for now. But broadly, it will involve
@pnemonic78 I believe I recieved your request for access. You should be able to download the file now.
examples of problematic ocmmodities in the gnucash file:
<gnc:commodity version="2.0.0">
<cmdty:space>Indian</cmdty:space>
<cmdty:id>ASIANPAINT</cmdty:id>
<cmdty:name>ASIANPAINT</cmdty:name>
<cmdty:xcode>INE021A01026</cmdty:xcode>
<cmdty:fraction>10000</cmdty:fraction>
<cmdty:get_quotes/>
<cmdty:quote_source>nseindia</cmdty:quote_source>
<cmdty:quote_tz/>
<cmdty:slots>
<slot>
<slot:key>user_symbol</slot:key>
<slot:value type="string">ASIANPAINT</slot:value>
</slot>
</cmdty:slots>
</gnc:commodity>
<gnc:commodity version="2.0.0">
<cmdty:space>MF</cmdty:space>
<cmdty:id>HDFC_MIDC_OPPO_UP4UI9</cmdty:id>
<cmdty:name>HDFC Mid-Cap Opportunities Fund -Direct Plan - Growth Option</cmdty:name>
<cmdty:fraction>10000</cmdty:fraction>
<cmdty:get_quotes/>
<cmdty:quote_source>googleweb</cmdty:quote_source>
<cmdty:quote_tz/>
</gnc:commodity>
I had a similar problem with the import of GnuCash files from desktop, but could fix it like this: I am using GnuCash Pocket on Android with version 2.5.2. I exported the file to GnuCash XML and opened it with GnuCash desktop. I noticed that the accounts for funds had their commodity changed to the currency "XXX (No currency)". (This must have already happened earlier when importing/exporting between Android and desktop, but I'm not sure.) To fix it using desktop, I could not change the commodity of the existing accounts, but had to recreate the accounts with the correct commodity and delete the other ones. Additionally, I had to delete all entries in the price database that referenced the old corrupted currency "XXX (No currency)". After these changes the files could be imported into GnuCash Pocket again.
Thank you for your work :+1:
Steps to reproduce the behaviour
Expected behaviour
GnuCash accounts on pc is successfully imported
Actual behaviour
A message popup with message "An error occurred while importing gnucash accoimts". No further information is show regarding the nature of error.
Software specifications
Suggested Resolution
I don't have enough knowledge, but could it be due to some kind of lock on file by desktop gnucash?? Sometimes desktop application shows the file has not been properly closed by previous instance or something and suggest to open as read only. You can still force to open it and continue to use without any problems.