Android Question B4X_cba problem

Theera

Well-Known Member
Licensed User
Longtime User
Refer to this After I've tested tchart's B4X_cba ,I've error code while compiling. How do I solve it?
B4A Version: 13.00
Parsing code. (0.05s)
Java Version: 19
Building folders structure. (0.03s)
Running custom action. Error
#####################
# B4X Custom Action #
#####################
An error occurred: Input string was not in a correct format.
My code is belows
B4X:
#Region  Addition CustomBuildActions
'Credits to: tchart's codes
'คุณสาารถเลือกปรับแต่ง CustomBuildActions เหล่านี้ได้อย่างเหมาะสม โดยการทำการ Unremark /Remark

'ประมวลผลเท่านั้น ( Compile Only)
'#CustomBuildAction: 2, %WINDIR%\System32\b4x_cba.exe, -action compileonly

'สำเนา Jar File to C:\Temp folder(CopyJar )
'#CustomBuildAction: 2, %WINDIR%\System32\b4x_cba.exe, -action copyjar -directory C:\TempTemp

'บันทึกวันเวลาที่ถูกสร้างขึ้นไว้ในไฟล์ Build.txt
'#CustomBuildAction: folders ready, %WINDIR%\System32\b4x_cba.exe, -action buildtime 
'หรือ
'#CustomBuildAction: folders ready, %WINDIR%\System32\b4x_cba.exe, -action buildtime -dateformat dd/MM/yyyy -timeformat HH:mm:'

'ปรับปรุงเป็นเวอร์ชันล่าสุด
#CustomBuildAction: folders ready, %WINDIR%\System32\b4x_cba.exe, -action updateversion

#End Region
 

DonManfred

Expert
Licensed User
Longtime User

buildtime​

b4x_cba will create a file called build.txt in the Files directory of your project with the current date/time. If you omit the date/time formats they will default to yyyy-MM-dd HH:mm:ss.

NOTE: Remember to sync the files after the first run.

updateversion​

b4x_cba will create a file called version.txt in the Files directory of your project with an incrementing version number in format 0.0.0-9.9.9

NOTE: Remember to sync the files after the first run.

#CustomBuildAction: folders ready, b4x_cba.exe, -action updateversion

Did you sync the files folder after 1. run? note that you probably should run buildtime once before you use updateversion. And do not forget sync.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Did you sync the files folder after 1. run? note that you probably should run buildtime once before you use updateversion. And do not forget sync.
I will do it tomorrow.My computer is at myoffice. Thank you for kind of you, DonManfred
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
@Theera

With "updateversion" it will attempt to parse an existing file if version.txt already exists. This can cause problems if the format is not X.X.X or the file is empty.

I believe the error is caused by an empty version.txt file. I have added logic to deal with this - new version is on https://github.com/ope-nz/b4x_cba

1734555291683.png


Also I see you are using "%WINDIR%\System32\b4x_cba.exe" for the path. It is tidier if you copy b4x_cba.exe to the install path of B4J etc. That way you can just omit the path

B4X:
#CustomBuildAction: folders ready, b4x_cba.exe, -action updateversion

1734554874387.png


Note, the sync is only required to get rid of the warning #17 in B4X. This doesnt affect the operation of the tool.

1734555114385.png
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Also I see you are using "%WINDIR%\System32\b4x_cba.exe" for the path. It is tidier if you copy b4x_cba.exe to the install path of B4J etc. That way you can just omit the path
Hi tchart,
Your b4x_cba.exe is exe file for crossplatform,so I copied it as the same folder as Erel's folder as my b4xtemplate file. My code is incorrect,isn't it?
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Hi again,
After using the new b4x_cba.exe,I found the another error code.
B4A Version: 13.00
Parsing code. (0.04s)
Java Version: 19
Building folders structure. (0.12s)
Running custom action. (0.17s)
Running custom action. (0.15s)
Running custom action. (0.11s)
Compiling code. (0.14s)
Compiling layouts code. (0.01s)
Organizing libraries. (0.00s)
(AndroidX SDK)
Running custom action. (0.16s)
Running custom action. Error
###############################################################
B4X Custom Action - testtttt
###############################################################
Compile Only
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
Hi again,
After using the new b4x_cba.exe,I found the another error code.
Hi Theera.

That error is expected. It is the way Erel suggested to stop the ide from running the project - the way it’s done it to return a deliberate error. That’s why it is done last. Less of an issue for b4a and b4i.

Your path is fine if you are using it for all platforms.
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
B4X:
'Ctrl + click to increment version: ide://run?File=b4x_cba.exe&Args=-action&Args=updateversion

Your code has the problem, you have to change as belows
B4X:
'Ctrl + click to increment version: ide://run?file=b4x_cba.exe&args=-action&Args=updateversion
It will be worked, but I have some problemabout coding in another thread. Please helpme.

Thread 'How to code the command link' https://www.b4x.com/android/forum/threads/how-to-code-the-command-link.164685/
 
Upvote 0

tchart

Well-Known Member
Licensed User
Longtime User
B4X:
'Ctrl + click to increment version: ide://run?File=b4x_cba.exe&Args=-action&Args=updateversion

Your code has the problem, you have to change as belows
B4X:
'Ctrl + click to increment version: ide://run?file=b4x_cba.exe&args=-action&Args=updateversion
Not clear on what the problem is. Did you just make some of the command lower case?
 
Upvote 0

Theera

Well-Known Member
Licensed User
Longtime User
Not clear on what the problem is. Did you just make some of the command lower case?
You have to try to do. I compared with Erel'scode for solved.
 
Upvote 0
Top