Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: A workaround has been posted for a critical issue for Android (RSP-18474)



Permlink Replies: 9 - Last Post: Sep 6, 2017 4:43 PM Last Post By: D Robinson
Dave Nottage

Posts: 1,850
Registered: 1/7/00
A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 3, 2017 3:44 PM
For those using Delphi 10.2 Tokyo (with the compatibility patch applied) for Android apps, a workaround has been posted
for a critical issue, namely:

https://quality.embarcadero.com/browse/RSP-18474

Which causes Android apps to crash after a running for a few minutes. It appears shyambabu kolipaka's workaround is the
most popular option. To save going back through the comments history in the report, here it is:

"unit Androidapi.JNIBridge
replace RemoveReturnValue procedure code with following code. Then the problem will be resolved."

class procedure TJNIResolver.RemoveReturnValue(Obj: Pointer);
var
  RefType : JNIObjectRefType;
  LJNIEnvRes: PJNIEnv;
  lJNIObject : JNIObject;
begin
  TMonitor.Enter(ReturnValuesJNIObject);
  try
    if ReturnValuesJNIObject.ContainsKey(Obj) then
    begin
      lJNIObject := ReturnValuesJNIObject[Obj];
      ReturnValuesJNIObject.Remove(Obj);
      LJNIEnvRes := TJNIResolver.GetJNIEnv;
      RefType := LJNIEnvRes^.GetObjectRefType(LJNIEnvRes, lJNIObject);
      if RefType = JNIGlobalRefType then
        LJNIEnvRes^.DeleteGlobalRef(LJNIEnvRes, lJNIObject);
    end;
  finally
    TMonitor.Exit(ReturnValuesJNIObject);
  end;
  TMonitor.Enter(ReturnValues);
  try
    ReturnValues.Remove(Obj);
  finally
    TMonitor.Exit(ReturnValues);
  end;
end;


For making patches such as this, I recommend making a copy of the unit, and including it with your project, or
somewhere in the compiler path, and make the modification.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
John Mitchell

Posts: 64
Registered: 9/23/02
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 6, 2017 6:55 AM   in response to: Dave Nottage in response to: Dave Nottage
This is a really big fix, for me at least, my Android app was crashing for no reason and I could not debug into it.

This should be better publicized, maybe in Google+ and other forums. I came across this thread only accidentally.

Thanks for posting, saved me a lot of time.
loki loki

Posts: 787
Registered: 7/1/02
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 6, 2017 7:46 AM   in response to: John Mitchell in response to: John Mitchell
On 8/6/2017 4:55 PM, John Mitchell wrote:
This is a really big fix, for me at least, my Android app was crashing for no reason and I could not debug into it.

This should be better publicized, maybe in Google+ and other forums. I came across this thread only accidentally.

Thanks for posting, saved me a lot of time.

anyway, no need to publicize it, just need to know that tokyo is not
working on android (their is many other bugs quite severious) and need
to wait the next release...
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 6, 2017 3:53 PM   in response to: loki loki in response to: loki loki
loki loki wrote:

anyway, no need to publicize it, just need to know that tokyo is not
working on android (their is many other bugs quite severious) and need
to wait the next release

Not everyone needs to wait for the next release. For me, the performance issue isn't significant enough to override the
benefits of other fixes in Tokyo.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
Jeremy North

Posts: 402
Registered: 9/20/99
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 6, 2017 7:54 PM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
loki loki wrote:

anyway, no need to publicize it, just need to know that tokyo is not
working on android (their is many other bugs quite severious) and need
to wait the next release

Not everyone needs to wait for the next release. For me, the performance issue isn't significant enough to override the
benefits of other fixes in Tokyo.

Tried compiling our app on Tokyo to get rid of critical keyboard issues with Berlin. Keyboard issue was fixed (not fully tested) but Tokyo bought overwritten text on iOS and random missing images.
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 7, 2017 3:13 PM   in response to: Jeremy North in response to: Jeremy North
Jeremy North wrote:

Tokyo bought overwritten text on iOS and random missing images.

Are there QP reports for these? Or at least some more detail?

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
loki loki

Posts: 787
Registered: 7/1/02
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 8, 2017 1:38 PM   in response to: Dave Nottage in response to: Dave Nottage
Not everyone needs to wait for the next release. For me, the performance issue isn't significant enough to override the
benefits of other fixes in Tokyo.

hmm i m curious what are these benefits ??

Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 8, 2017 1:47 PM   in response to: loki loki in response to: loki loki
loki loki wrote:

hmm i m curious what are these benefits ??

The fixes that have been addressed in Tokyo and the subsequent update. There's a whole bunch of them in this list alone:

https://edn.embarcadero.com/article/44747

Including non-platform-specific issues that also affect Android.

--
Dave Nottage [MVP, TeamB]
Find hints, tips and tricks at Delphi Worlds blog: http://www.delphiworlds.com
John Mitchell

Posts: 64
Registered: 9/23/02
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 7, 2017 3:22 PM   in response to: Dave Nottage in response to: Dave Nottage
In my case, Berlin had Android keyboard issues in TEdit (maybe TMemo too, I cant remember) and Tokyo fixed it for me.
This new patch solves my mystery crashes.

I haven't tried my app on IOS yet, I need to buy some more aspirin first. Or gin.
D Robinson

Posts: 7
Registered: 11/2/99
Re: A workaround has been posted for a critical issue for Android (RSP-18474)
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 6, 2017 4:43 PM   in response to: John Mitchell in response to: John Mitchell
John Mitchell wrote:
In my case, Berlin had Android keyboard issues in TEdit (maybe TMemo too, I cant remember) and Tokyo fixed it for me.
This new patch solves my mystery crashes.

I haven't tried my app on IOS yet, I need to buy some more aspirin first. Or gin.

Mostly my keyboard issues are gone in Android as well.I think there may still be an issue if a space is inserted. I have not been able to clarify the issue.

Hopefully, this thread will help me cure the occasional crashing issues in Android. I installed the fix and will see if the crashes disappear. If it does fix -- thanks to all who contributed.

FWIW the current app has at least thirty tables in Interbase and will probably gain a dozen more. Most, obviously are lookup tables -- but each requires a screen. Most of the data entry can be done on Windows and the entire DB exported with the program. I am wondering if maintenance will be a bear.

What kept me working on this project was Interbase -- it would have been very ugly on SQLite.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02