Android Question What am I missing? Tried to run a brand new project.

Kevin

Well-Known Member
Licensed User
Longtime User
I created a quick test project in order to post a different question about something I am confused about regarding default text and background colors on views, but I am having a strange problem right out the gate.

I created a layout, adding a bunch of random views, and named it "Layout1".

Then I added the line to load that layout in Module Main, Activity_Create.

Is there more I need to do to run this? It crashes immediately with no errors.

I also noticed that in top section of the Logs window (where it shows issues with the code), it says that the layout file was not added to the files tab and also that it is not used.

I know it's been a LONG time since I created an all-new project but I'm pulling what's left of my hair out.

I'm using B4A 8.30 and referencing Android-27 jar.

upload_2018-6-17_19-13-42.png
 

RichardN

Well-Known Member
Licensed User
Longtime User
I guess you added 'layout1' with the designer or copied it from elsewhere?

Start by hitting Files tab > Sync and try to compile again. If no joy go for a PC cold restart, it is sometimes the only way to fix IDE misbehaviour.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
It was with the designer. That is one reason why I thought it was odd to say it wasn't added to the Files tab.

If I recall correctly, I think I may have forgotten to load it the first time compiling and pressed cancel, added the LoadLayout, then tried compiling again.

I don't have access to this computer now (I'm at work) but I will try cleaning the project and try compiling again when I get home. I'm pretty sure I tried that already though.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
At one point I did remove it, then added it again (through the Files tab), but that was after seeing both of those warnings. I'm pretty sure I also completely closed B4A and re-opened the project but nothing changed.

I will try syncing when I get home tonight (though I may have done that - I can't remember and my memory is not so great these days :confused:). I wish I could remember the exact steps I made. I may have originally forgotten to save the layout and was told to save it when I first tried compiling. After saving it, I started compiling again but canceled it because I realized I hadn't loaded the layout in Activity_Create. The next compile finished but the app crashed immediately, and eventually I noticed the warnings. I do know that I tried "clean project" at least a few times.

There literally is nothing in the code except dimming the views, empty click events and loading the layout. Would an app that essentially has no code run (but do nothing) or crash immediately? Android just said the app stopped working. I'm trying to see if the two problems are related.

Edit: If I get home and still cannot get it to work (either the warnings or crashing if an empty app should not crash) then I will zip it and post here.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
Update: I opened the project, clicked on the Files tab then clicked on Sync. Nothing happened (no messages, though I'm not sure I should expect any). I clicked on Add Files, and added the Layout file, even though it was already listed in the Files tab. Nothing happened. Then I clicked on Clean Project, turned on debug mode and tried running the app. The error is caused by the Layout1.bal file not being in the compiled apk, and I assume that is because B4A thinks it is unused.

I also tried clicking on 'Tools > Clean Files folder' and it said that there were no unused files. :confused:

Project attached.

A potential clue: After zipping the project, I had a look inside the zip just to see what all it contained. I noticed that the Layout1.bal file was in all lower-case in the zip, which was not the case in the project's actual Files folder. So I changed the 'L' to 'l' in the project's Files folder and re-opened the project. The warnings in B4A went away and I was able to get it to run once, but then the same crash kept happening again on subsequent recompiling (and cleaning the project). The problem seems to be related to case (upper/lower) but I don't know where the glitch got introduced or why it seems to keep happening.

upload_2018-6-18_18-34-48.png

upload_2018-6-18_18-36-49.png


upload_2018-6-18_18-35-58.png


upload_2018-6-18_18-38-17.png
 

Attachments

  • B4ATestProject.zip
    9.7 KB · Views: 226
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
just tested your project.. all good here, not errors..

your error shows "layout1" maybe it shoul be Layout1
try to create a new layout2 and use it to see what happen..
Untitled.jpg
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
Yes, that seems to be it. I did some more thorough testing, and after changing the file "Layout1.bal" to "layout1.bal", the B4A warning went away and the app runs. The IDE still shows it with an upper-case L.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
It was the upper-case L in the Layout1.bal file. When B4A zipped the project, it got changed to a lower-case L, which does work.

No idea how this glitch happened though.
 
Upvote 0

Kevin

Well-Known Member
Licensed User
Longtime User
Just a quick note to say that this was wrong. I was working with two copies of the same project. One worked and the other did not.

but then the same crash kept happening again on subsequent recompiling (and cleaning the project)
 
Upvote 0
Top