Android Question Error: code too large for try statement catch (Exception e) - is it a bug?

JOTHA

Well-Known Member
Licensed User
Longtime User
Hi community,
yesterday my app worked without errors, but today there is the following message, when I want to compile the code in Debug-Modus:

To solve the problem, I deactivated all "try-catch" code in the source, but the error-message is the same.
If I compile in Release-Mode, everything is working.

Is it a bug?
 

JOTHA

Well-Known Member
Licensed User
Longtime User
Thank you Sandman.
I used the search function before but I found a statement from 2013 and meant, that is solved.
Now I understand that there is a limitation from java and I have to split the sourcecode if it is >64k.

My problem is caused by generating a PDF-File ... so I have to check out what is to do.
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
Post some code.
Hello Erel,
thank you very much for your offer to help.
I found a solution by shortening the code.
It was only a large PDF-Page with a lot of text.
If someone is interested in ... I will post it here.
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
Sounds like a big mistake.
Yes you are right!
I wanted a "millimeter-paper" underlying on every page and did it like this (first time):
B4X:
'    PDF.Canvas.DrawLine(5dip, 5dip, 210dip, 5dip, Colors.LightGray, 1)        '-- Quer-Linie 01
'    PDF.Canvas.DrawLine(5dip, 10dip, 210dip, 10dip, Colors.LightGray, 1)        '-- Quer-Linie 02
'    PDF.Canvas.DrawLine(5dip, 15dip, 210dip, 15dip, Colors.LightGray, 1)        '-- Quer-Linie 03
'    PDF.Canvas.DrawLine(5dip, 20dip, 210dip, 20dip, Colors.LightGray, 1)        '-- Quer-Linie 04
etc ...

I wasn't able to create a formula-code with "dip"-measures ...

The right way is to do it like this:
B4X:
    Dim QuerLinieLinks, QuerLinieOben, QuerLinieRechts As String
    QuerLinieLinks = 0
    QuerLinieOben = 0
    QuerLinieRechts = 595
    For i = 0 To 842 Step 10
        QuerLinieOben = i
        Log("M070-0417 -----► QuerLinieOben: "&QuerLinieOben&"")
        PDF.Canvas.DrawLine(QuerLinieLinks, QuerLinieOben,     QuerLinieRechts, QuerLinieOben, Colors.LightGray, 1)
    Next
etc. ...
... thats it.
 
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
I can implemnent a PDF with 1.000 Pages in my app
Do you use the Printing-Library or your PDFium-Lib?
I guess ... PDFium

I use Printing and I should be able to shorten the code by splitting it in small Subs ... like this one (but it doesn't work)
B4X:
Sub Marker
    Dim PDF As PdfDocument
    PDF.Initialize
    PDF.Canvas.DrawLine(14, 289, 27, 289, Colors.Black, 1)
    PDF.Canvas.DrawLine(564, 289, 577, 289, Colors.Black, 1)
End Sub

I should make different Subs for a Page-Header and a Page-Footer ...
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

JOTHA

Well-Known Member
Licensed User
Longtime User
I've seen that ...
Create PDF with b4a and php
.. and thanks for telling me the reporting tool ... it looks very good ...

but I don't need such a professional tool and I'd prefer a PDF-code without using a internet-connection.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…