Android Question Question for B4A developers (not for B4a users..)

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi.
In a very difficult situation, happened a very strange thing: I had an App perfectly working. I "just" changed a function, and now B4A refuses to execute (not to compile) the App. The debugger doesnt work too so I cannot do anything. Of course I did something wrong, or, maybe, did I reach a limit in the program.. I attach the two projects: one works, the other not. The only difference is the function StandardDeviations. Curiously, even taking it away, the problem doesn't resolve. Sincerely I am a little desperate ..
 

Attachments

  • GComX_A_err.zip
    50.7 KB · Views: 123
  • GComX_A.zip
    51.2 KB · Views: 105

Sandman

Expert
Licensed User
Longtime User
There are three differences between the projects:
  1. A change in code: It's all in the sub StandardDeviations, just as you wrote.
  2. A change in the .meta file, which shouldn't affect anything.
  3. A file change: You deleted icon.png and replaced it with icon.jpg - perhaps this is the cause.

I have not tried to run the projects, only made a diff of their directories using Meld:
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Thanks. I cannot exclude what you say, but, in same project, minutes before , the App worked. I just added the different code. I absolutely did not change any icon. Moreover, needing to resolve, I changed that function, that actually was not well done, because some code was repeated. Now it works again. The problem is resolved, so I am quiet now and don't need any urgent help anymore. But, with time, I will check everything.. Thanks again.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
I tried your projects.
I do not understand why you get the problem.
I commented everything with StandardDeviation, the routine and the calls, and the project works.
Then, in then StandardDeviation routine I began to uncomment the lines by blocks.
When commenting the last line the project works.

1653328890487.png

When uncommenting the last line the project crashes ?

The project works with the Legacy Debugger.
I am afraid that you reach a limit in the Debugger.

I think that only Erel could give a concrete answer.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi, Klaus. Thanks a lot for your patience. Actually things are weird. I know that normally the fault is mine, but this is really a strange case. I posted the two projects exactly to allow a technical analysis. I guess it is not a problem for users, as I said. There are some connected topics, but being that I was in panic, I cannot guarantee that I did all well. I mean: the very first trial I did was to take away completely the StandardDeviations sub, and still the problem remained. Then I copy/pasted (with b4a) the code between the two apps (the working and the not-working one), with no result. I reinitiated either the tablet or the computer etc. Finally: it is not a problem of debugger, because the App, in release mode, simply crashed. Thanks for confirming that things are (or at least seem) as I described. I resolved the problem starting from the working code, and adding by hand new code. Luckily that function was not well writtten. I did a new one and things work now. The question is: did I reach a limit, or it is a situation related to this case.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Don't know. I have Samsung Galaxy Tab S2 and Samsung Galaxy A13. On both the problem exists. Btw Klaus confirmed, so I cannot say anything more. Thanks for trying. N
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
To me in debug it works in release it breaks.

So I thought about this change which solved the problem. Now it doesn't stop
B4X:
Sleep (0)
DiMed = Media (DiMedD, DiMedI)

PS. I was struck by your title: for B4A developers (not for B4a users..)
I have always thought that whoever used B4A did it to develop not like WordEditor ... Even if some are not professional developers, I believed that they were developers.

I take note of your subdivision and ask myself: Since the problem is only for non-user developers who would not be able to solve it. Which group do you position yourself in?
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. Thanks for reply. I appreciate your opinion on the title. Maybe it is a misunderstanding. I was meaning that such behaviour, rather weird, related to an apparently innocent instruction, was out of the concern of a "user" of B4A, like I and all people here are. We develop products using B4A. We use B4A. We didn't develop B4A. This was what I was meaning. The question was devoted to people (from Klaus answer probably only Erel), that can understand what's happening. You didn't understand the problem, sorry. You just found an empirical remedy. Why putting a Sleep(0) ? If you look to another recent post of mine, you will see that I met a problem just naming a service "s1". Has this a sense? Of course I changed the name and things worked, but I don't say that I have understood why or that I solved the issue In the present case, shall we put a Sleep inside calculations (not so heavy, anyway). By the way it crashes at the beginning, not when such calculation is done ... Or, as usual, I didn't understand what I was doing.. as usual ..Anyway thanks again.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Hi. Thanks for reply. I appreciate your opinion on the title. Maybe it is a misunderstanding. I was meaning that such behaviour, rather weird, related to an apparently innocent instruction, was out of the concern of a "user" of B4A, like I and all people here are. We develop products using B4A. We use B4A. We didn't develop B4A. This was what I was meaning. The question was devoted to people (from Klaus answer probably only Erel), that can understand what's happening. You didn't understand the problem, sorry. You just found an empirical remedy. Why putting a Sleep(0) ? If you look to another recent post of mine, you will see that I met a problem just naming a service "s1". Has this a sense? Of course I changed the name and things worked, but I don't say that I have understood why or that I solved the issue In the present case, shall we put a Sleep inside calculations (not so heavy, anyway). By the way it crashes at the beginning, not when such calculation is done ... Or, as usual, I didn't understand what I was doing.. as usual ..Anyway thanks again.
I put the Sleep on for a reason that I have explained.
In Debug mode on my device (Samsung S6) it does not go into error. In release mode it fails.
I assumed that the difference is due to the fact that release mode is faster than debug and therefore fails to finish some necessary operations. Entering a Sleep (0) would return control to the system to complete.

This worked for me
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Please note that crashes at beginning. That instruction was not yet called. It is not a problem directly related to the use of that instruction, at all, in my opinion. It seems that with that instruction, the whole program is corrupted. I suspect something related to the names of the variables. But just suspect. Even, when I was in panic, and I took away the entire sub (I left it empty), and the problem was not resolved.. Weird.. at least .. Anyway, forget about. I somebody can resolve, weel, otherwise I go on. B4A is a very good product that helped me lot..
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
If you look to another recent post of mine, you will see that I met a problem just naming a service "s1"
Some names may be reserved because used inside or coincide with other objects present. This happened to me a few times then I learned to customize the names of variables, classes and objects
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Please note that crashes at beginning. That instruction was not yet called. It is not a problem directly related to the use of that instruction, at all, in my opinion. It seems that with that instruction, the whole program is corrupted. I suspect something related to the names of the variables. But just suspect. Even, when I was in panic, and I took away the entire sub (I left it empty), and the problem was not resolved.. Weird.. at least .. Anyway, forget about. I somebody can resolve, weel, otherwise I go on. B4A is a very good product that helped me lot..
I have noticed this. It fails at first, yet for some reason it works.
My solution doesn't answer the reason for the problem, but solves it based on @klaus' report.
As soon as I have time I will look better and maybe if I am lucky I will find out the reason
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Log not filtered
java.lang.VerifyError: Verifier rejected class GComA.b.main: java.lang.String GComA.b.main._standarddeviations() failed to verify: java.lang.String GComA.b.main._standarddeviations(): [0x161] Rejecting invocation, long or double parameter at index 2 is not a pair: 15 + 0. (declaration of 'GComA.b.main' appears in /data/app/GComA.b--2zO9wlexV5Z5vZK4Qg2Ug==/base.apk)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1180)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2831)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
!@DumpState : SHIP
!@DumpState : debug level:0x4f4c
!@Dumpstate : Finally, system will skip dumpstate
Maybe you are wrong the problem is not at the beginning but just like @klaus says in standarddeviations Sub

I replaced this and it worked. (And I didn't even put Sleep ;))
B4X:
'DiMed=Media(DiMedD,DiMedI)
DiMed=Abs(DiMedD+DiMedI)*.5
Does this also seem empirical to you?

Anyway, forget about. I somebody can resolve, weel, otherwise I go on.
I will take this into account for your next request for help :p
 
Last edited:
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. Yes, it is empirical. I just did a funny simple function. Tell me where is the problem in doing a simple function like that. I said "Forget about" not to further disturb you. Please don't misunderstand, your comments are welcome. But, just to gon on with our friendly polemic, the new working app uses the sub Media. Anyway, I want to fix it again: it crashes at the beginning, when that function is not called. To be sincere, not being fond of Java at all, maybe the log that you printed is useful. You used same Variable name. Therefore it is not the variable name. Moreover the function exists in the new app..
 
Upvote 0
Top