Android Question B4A IDE - Project Clean Wish

Status
Not open for further replies.

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

I find that I use project clean pretty much all the time. It seems necessary to ensure that the app gets updated properly particularly when optimizing screen layouts where you must continually recompile and run on the Phone.

Could you do the following?

  1. Under IDE Options Menu add an option checked item to automatically do a program clean before compiling and running
  2. Add a program clean button to the toolbar say to the left of the run button for those who don't like item 1.
I know you can do Control P to do a clean, but I am a two fingered typist and use the mouse as much as I can.

Best regards

Rob
 

Brian Dean

Well-Known Member
Licensed User
Longtime User
If you really have to use Clean all of the time then you are doing something wrong. Try and fix that!
 
Upvote 0

Jorge M A

Well-Known Member
Licensed User
Longtime User
I use project clean pretty much all the time.

I guess eventually this option will also be available in B4A. At the moment it is announced that they will be supported on B4J and B4I.

Notes
  • The ide://run method supports these additional arguments:
    • FilesSync=True - Causes the IDE to sync the Files folder after operation completes.
    • CleanProject=True - Causes the IDE to clean the project after operation completes.
    • VMArgs - Similar to Args but added as a JVM argument.
      You can add: VMArgs=-DZeroSharedFiles%3DTrue to a zipper call to delete the content of the platform specific copies of shared files (the content will be added back when the program runs, because of the custom build action).

 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
If you really have to use Clean all of the time then you are doing something wrong. Try and fix that!

Hi

You don't get any error messages when you run an app that needs a clean, the app just doesn't run properly.
Where do you start looking for the problem?

Best regards
Rob
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
I guess eventually this option will also be available in B4A. At the moment it is announced that they will be supported on B4J and B4I.




Hi Erel,

  1. What is an IDE run method?
  2. Is their a tutorial on this?
Best regards
Rob
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
You don't get any error messages when you run an app that needs a clean, the app just doesn't run properly.
Where do you start looking for the problem?
I think that you have to start by accepting that cleaning a project is not normal. If you Google for other examples of essential project cleaning these are usually cases of specific, often very large projects over which the user has lost control - they are not speaking of project cleaning "pretty much all the time".

So stop project cleaning as a habit - instead treat the problem an intermittent bug, or maybe one of those "impossible" ones where you can see that everything is correct but still something is going wrong in execution - you don't get any compiler messages there, either. Try and separate those projects where frequent project cleaning is required with those (surely there must be some) where you do not have to clean. Where cleaning is needed, try to find some common preceding activity that might be the cause. In particular, when you work on a new project (starting a new dummy project might be a good idea) be on the lookout for the first time that you have to clean the project - what had you just done for the first time?

My concern with your wish to institutionalise project cleaning in the IDE is that this is the very opposite of my first step. Not only would that stop you ever discovering what you were doing wrong, it would prevent every other B4X user ever being aware that they had done something wrong.
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
Hi Erel

Well I stopped cleaning and the problem occurred and I think I can explain the steps I am using a cheap Oppo phone with the B4A bridge. I would like to use the emulator, but I cannot get it to work.

1. Program working
2. Made mods to program
3 Program crashed with an explainable fault.
4 Fixed fault (picket fence problem)
5 Did not clean
6 Pushed compile run button
7 App started without uploading the new App code file and the debugger didn't connect over the bridge
8. Closed program with back button - App closed
9. Pushed the compile run button - No device found
10 Reconnected the bridge in the IDE
11. Pushed compile run button again
12 Program didn't load into the phone but the Debugger is connected and the app doesn't seem to be running The debug Window is open.
13. I am just staring at the B4 Bridge app on the phone
14. When I look at the running apps bizzo on my phone it says the app isn't running
15. Pushed the compile run button again no upload, but the app is now running and the debugger is connected.
16. Pushed the little square button on the IDE and closed the app.
17. Pushed the compile run button and guess what? the app started straight away with no upload.
18. Did a Clean
19 Pushed compile/run
20; Phone asks whether I want to install
21 Of course I did
22 App Installed
23 Phone asks if I want to run
24 Of course I did
25. App is running fine and connected to debugger.


I could go on, but you get my point.

It seems to me that the IDE seems to do a reset (little round arrow button) rather than a compile load when you push the little Right arrow button without a clean.

If you clean the project it seems to force the IDE to upload new code.

I've used a lot of IDE's in my time and they usually don't need a clean. When you do a compile the IDE decides to do what the user wants which is to update the code in the target and then run it, not just reset the target back to the start of the old code.

I will keep up my cleaning as this certainly fixes my problem.

I can't see what a user can do wrong with all of this. You say I must be doing something wron, but you don't give me a clue on what that might be.

It seems to me that the steps are:

1. You write some code
2. You compile it with the compile/run button
3. If it's syntactically correct with no compiler errors it is uploaded and runs.
4. If there are errors and the program crashes you look at the log and the code, figure out what's wrong and start back at step 1

I can't see how me as the user has any other options or creative ways to do the wrong thing.


Best regards

Rob
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
I think that you have to start by accepting that cleaning a project is not normal. If you Google for other examples of essential project cleaning these are usually cases of specific, often very large projects over which the user has lost control - they are not speaking of project cleaning "pretty much all the time".

So stop project cleaning as a habit - instead treat the problem an intermittent bug, or maybe one of those "impossible" ones where you can see that everything is correct but still something is going wrong in execution - you don't get any compiler messages there, either. Try and separate those projects where frequent project cleaning is required with those (surely there must be some) where you do not have to clean. Where cleaning is needed, try to find some common preceding activity that might be the cause. In particular, when you work on a new project (starting a new dummy project might be a good idea) be on the lookout for the first time that you have to clean the project - what had you just done for the first time?

My concern with your wish to institutionalise project cleaning in the IDE is that this is the very opposite of my first step. Not only would that stop you ever discovering what you were doing wrong, it would prevent every other B4X user ever being aware that they had done something wrong.

Hi Brian,

I am NOT trying to institutionalize cleaning. The default setting of the revised IDE could be "No Clean" which would retain the status-quo unless a recalcitrant user like me changed it. I am not asking for everyone to do a clean if they don't wish to.

I have had this problem with numerous B4A projects and I simply do not have enough time or knowledge to debug the problem. If I had written the code for the IDE and all of the associated bits and pieces and understood haow it all works might have a go at it. But it's not my code and I don't think I could do what Erel et all have done anyway.

As an example I use Keil uVison to program in C and C++ for embedded systems. uVison provides three compilation options:
  1. Compile a single file - produces object code and auxiliary files as output, but no linked executable
  2. Compile and Link only those files that have changeg including source files whose haders have changed - Produces object code and executable that can be loaded and run
  3. Compile every file in the project - Produces object code and executable that can be compiled and run.

I have used 1 infrequently, 2 most of the time never had to use item 3 as the IDE keeps track of which files are up to date and which need to be recompiled.


Best regards
Rob
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Okay - I know that you wish things were different, but here you are in a frustrating situation. I am not sure that I can help you much but here are a couple of observations from your case study above. At step 7 ...
7 App started without uploading the new App code file and the debugger didn't connect over the bridge
That is what happens when you run in debugger mode - your app is not actually running in the device (don't ask me how this is achieved) and code changes are "instantly" applied without the need to download a replacement app. It is very quick - just what you want when debugging. You have to be a little careful if you make a coding change in initialisation code, of course, as this code might not run again when you restart.

Also Step 9 ...
9. Pushed the compile run button - No device found
This is also suspicious because the bridge does not disconnect in normal circumstances - something has already gone wrong.

Look - you probably have an expectation that something somewhere should happen in a certain way and are acting accordingly, but in fact your expectation is incorrect. I am afraid that I can't look at this any more at the moment. I will come back to it later in the day if I can. Good luck.
 
Upvote 0

AnandGupta

Expert
Licensed User
Longtime User
My experience:
  1. In debug mode, if you change in designer, you need to clean project as it is not pushed to the phone.
  2. In release mode, if you change in designer, you do not need to clean project as new apk is pushed to the phone
I follow it and have no problem, as I know what to expect.

Regards,

Anand
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This thread is too messed up to be useful.

You don't need to clean the project in order for the layout file to be updated. This is not a common issue. Anyone who encountered such issue should start a new thread and we will further investigate it.

It sounds like the real issue is a connectivity issue. First step is to switch to USB debug mode instead of B4A-Bridge. Second step is to disable the anti virus which might be causing an issue.
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
My experience:
  1. In debug mode, if you change in designer, you need to clean project as it is not pushed to the phone.
  2. In release mode, if you change in designer, you do not need to clean project as new apk is pushed to the phone
I follow it and have no problem, as I know what to expect.

Regards,

Anand

Hi Anand,

Yes,

That is my experience. I forgot to mention that it works without cleaning in Release mode. The pushing to the phone is the issue here I think

But of course you only use release mode towards the end of the app development cycle.

I'm beginning to wish I hadn't brought up the issue. It seems to be a lot of pole-volting over mouse droppings for an issue that is easily fixed with a clean.

Best regards
Rob
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
Okay - I know that you wish things were different, but here you are in a frustrating situation. I am not sure that I can help you much but here are a couple of observations from your case study above. At step 7 ...

That is what happens when you run in debugger mode - your app is not actually running in the device (don't ask me how this is achieved) and code changes are "instantly" applied without the need to download a replacement app. It is very quick - just what you want when debugging. You have to be a little careful if you make a coding change in initialisation code, of course, as this code might not run again when you restart.

Also Step 9 ...

This is also suspicious because the bridge does not disconnect in normal circumstances - something has already gone wrong.

Look - you probably have an expectation that something somewhere should happen in a certain way and are acting accordingly, but in fact your expectation is incorrect. I am afraid that I can't look at this any more at the moment. I will come back to it later in the day if I can. Good luck.

Hi Brian,

Thanks for that piece of info:

Another piece of the jigsaw - "your app is not actually running in the device"

How did you find that out?

If this is the case it would seem that the B4A debugging system is just using the phone UI. (Screen, buttons, audio etc) Is this correct? It would make a lot of sense to do it this way.

The interesting thing about this is that when debugging the code is being run in an Intel x86/64 processor environment, but then is run on an Android which usually has an ARM processor. It shouldn't matter of course because the java engine and operating system of the phone should make the environment identical from the Apps point of view.

What about things like DB files? Is it using the ones on the phone or the pc files of the project?

So cleaning isn't required, as once the app is loaded for the first time under debugging, stopping the debugger making the code changes then restarting the debugger is using the modified code based on the PC of the IDE.

It all becomes clear.

As for the B4A bridge dropping out, this only happens occasionally. It might be caused by my switching B4A IDE instances and forgetting to reconnect to the instance I am working on.

I am going to reinstall my copy of the Genymotion Android Emulator. It costs a little bit, but it is easy to install and works every time. This will make my development a bit smoother.

Thanks again.

Best regards
Rob
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
This thread is too messed up to be useful.

You don't need to clean the project in order for the layout file to be updated. This is not a common issue. Anyone who encountered such issue should start a new thread and we will further investigate it.

It sounds like the real issue is a connectivity issue. First step is to switch to USB debug mode instead of B4A-Bridge. Second step is to disable the anti virus which might be causing an issue.

Hi Erel,

Brian has provided an explanation as to what goes on with debugging, restarting debugging etc.

I will drop the matter now and on the basis of the info Brian provided I will keep going with my Apps without cleaning and check that code changes are being updated from debugging run to debugging run. It might be that I was confused about the layouts because I didn't understand the debugging process.

My problem is that I assume things are done in B4A/Java like they are in languages compiled into machine code which of course Java is not.

Please be patient with me as my whole life has been devoted to old fashioned software rather than this cross platform technology.

Best regards
Rob
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
As for the B4A bridge dropping out, this only happens occasionally. It might be caused by my switching B4A IDE instances and forgetting to reconnect to the instance I am working on.
This is of course the problem. Most of the other information in this thread is wrong.
You don't need to do anything special to update files or layouts.

I recommend you to start with a single instance of B4A running.
 
Upvote 0

rgarnett1955

Active Member
Licensed User
Longtime User
Hi Erel,

I arced up Genymotion emulator and since using that all is good. I don't have to worry about the Bridge connection and can switch between B4A instances with no difficulties. I never have more than three instances open, mostly two, because you can end up editing the wrong app. It is also a lot faster using the emulator as the inital program up-load is virtually instantaneous on my machine. Once you start debugging moifying then restart and compile is instantaneous.

I noticed in the Tools - B4A Bridge - Connect menu F2 will connect with the last IP address used. Control keys are OK, but if as I do you use heaps of different apps each with their own Function key shortcuts it becomes impossible to remember them all. If you do pretty much all your programming in B4A then of course remembering all the shortcuts isn't a problem. So I still think it's worth considering putting the B4A Bridge connection on the toolbar, but if you don't I will probably get over my grief.

Is Brian correct about how the debugger works i.e. it runs on the PC not on the phone? I understand about the layouts, I think that was a red herring. What else is wrong about the information? Anything important?

Best regards
Rob
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
What else is wrong about the information? Anything important?
The only relevant information in this thread is in post #17, where you told us that you are running two IDEs connected with B4A-Bridge to the same device. Assume that everything else is wrong.
I'm not going to read all the posts where you haven't provided enough information and say what is exactly wrong. If you have any specific question then start a new thread.
 
Upvote 0
Status
Not open for further replies.
Top