Android Question Error description: Unknown type: b4xmainpage

JMB

Active Member
Licensed User
Longtime User
Hi all,

I am trying to resurrect an old project. I completely reinstalled everything for B4A and am running 12.5

I loaded in some of the old code and libraries and now when I try to compile I get:

B4A Version: 12.50
Parsing code. Error
Error parsing program.
Error description: Unknown type: b4xmainpage
Are you missing a library reference?
Error occurred on line: 73 (B4XPages)
Public Sub MainPage As B4XMainPage

I set the project up using the Default template rather than B4x and I have no reference to b4xmainpage in any of my code.

I have reinstalled v12.5 again and I still get the same problem.

Any help would be gratefully received.


Jonathan
 

DonManfred

Expert
Licensed User
Longtime User
How can anyone help if you do not upload a small project showing the problem?

Guess you are in the switch from Activities to B4XPages? Or are you using B4XPages-Code in a Activity-Project?
Check the B4XPages-Tutorial and look how the directory structure is done here.

Best is to upload a small project showing the problem.
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Hi Manfred,

Thanks for taking the time to reply.

The problem does not show itself if I create a small project using the 12.50 Default project template - it compiles succesfully

The code I was using was pre-B4X Pages.

I created a new project based on the "Default" project setting, and I imported the old code from the old project.

Does the Default template use B4X pages in the background somehow?

Best regards,

Jonathan
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
ok,
default template of what?

Sorry, poor comms from me - I decided to go with Classic B4A Project as the base for the project as the original code was built as a classic B4A project, and I thought that with 12.50 that would mean it would recompile ok.

The reason I am doing this is because when I just try to compile the original code using 12.50, I was getting this problem:

B4A Version: 12.50
Parsing code. (0.19s)
Java Version: 14
Building folders structure. (0.13s)
Compiling code. (0.23s)
Compiling layouts code. (0.07s)
Organizing libraries. (0.33s)
(AndroidX SDK)
Compiling resources (1.41s)
Linking resources (1.43s)
Compiling generated Java code. Error
error: invalid flag: gen\b4a\navplan\R
Usage: javac <options> <source files>
use --help for a list of possible options

javac 14.0.1

and no matter what I did, I could not get that invalid flag problem to go away, so I decided to rebuild the poject.

If anyone knows how to fix the invalid flag problem, that would help and I could just use the original code.

JMB
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Does the Default template use B4X pages in the background somehow?
No.

What exactly did you do ?
And what do you want to do ?
Do you want to run the old project or do you want to update it to B4XPages ?

I just made a new project selecting in the menu File / New / Default.
Entered a new folder and got the default template and layout.
Changed the #ApplicationLabel: NewOldProject on top of the code and changed the Package name in Project / Build Configuration.
Ran the program and it works.

You could also simply run the IDE, load your b4a file and run the program. It should work.

When you created the new project you have probably chosen File / New / B4XPages instead of File / New / Default.
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User
Hi Klaus,

Thank you for your reply.

I definitely chose the Default option for the build.

The whole reason I've ended up trying to recreate the old project in a new Default project is because when I opened the original code and tried to compile it, I got this error:

I've uninstalled everything and reinstalled everything including the java compilers exactly as the B4A website says, but I can't get rid of this problem. That's why I am trying a new project.

JMB
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User

I'd like to be able to just run the old code, but as explained, it won't compile - it just comes up with the java compiler error.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
I'd like to be able to just run the old code, but as explained, it won't compile - it just comes up with the java compiler error.
Try to export your old code as zip in new IDE and unzip it to a new project, and then re-compile it
 
Upvote 0

epiCode

Active Member
Licensed User
1. Your initial problem was different from what you are telling now
2. If you already HAVE old code, why would you need to select b4xpages or for that matter anything "NEW"
3. If old code is b4xpages, did it compile correctly earlier? if yes, with which java and IDE version?
 
Upvote 0

JMB

Active Member
Licensed User
Longtime User

Yes, I think I've ended up documenting two problems here now which wasn't really my intent.

Problem 1 is the fact that the original code (written about 5 years ago) brings up the invalid flag error
Problem 2 is the Unknown type: b4xmainpage when I try to compile a new version of the code.

I will try the idea of ZIPing it then loading it back into the IDE and see how that works out.

If that doesn't work, I will put it up here and see if any of you kind people can figure this out.

Thanks to all for your help.

JMB
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…