Skip to content

Fix the crash issue on the Android platform caused by an invalid context.#18036

Merged
minggo merged 3 commits into
cocos:v3.8.6from
bofeng-song:v3.8.6
Dec 17, 2024
Merged

Fix the crash issue on the Android platform caused by an invalid context.#18036
minggo merged 3 commits into
cocos:v3.8.6from
bofeng-song:v3.8.6

Conversation

@bofeng-song

Copy link
Copy Markdown
Contributor

Re: #
#17910

Changelog


Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@github-actions

github-actions Bot commented Dec 13, 2024

Copy link
Copy Markdown

✅ Package size is not changed

Interface Check Report

This pull request does not change any public interfaces !

@dumganhar

Copy link
Copy Markdown
Contributor

@cocos-robot run test cases

@github-actions

Copy link
Copy Markdown

@bofeng-song, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS FAIL particle-color particle-color
ios PASS PASS FAIL LoadSpine LoadSpine
mac PASS PASS FAIL particle-2d-position-type-change keyboard-event,BuildTimeConstantsTest,particle-2d-normal

@github-actions

Copy link
Copy Markdown

@bofeng-song, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
windows PASS PASS FAIL keyboard-event,BuildTimeConstantsTest
android PASS PASS FAIL particle-trail2,BuildTimeConstantsTest
wechatgame PASS FAIL FAIL


JNIEnv *env = cc::JniHelper::getEnv();
auto *javaGameActivity = cc::JniHelper::getActivity();
auto *javaGameActivity = cc::JniHelper::getContext();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we also rename the variable name to auto *javaContext ?

@dumganhar dumganhar marked this pull request as draft December 16, 2024 07:57
@dumganhar dumganhar marked this pull request as ready for review December 16, 2024 08:58
@dumganhar

Copy link
Copy Markdown
Contributor

@cocos-robot run test cases

@github-actions

Copy link
Copy Markdown

@bofeng-song, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
web-mobile PASS PASS FAIL anim-widget
ios PASS PASS PASS
mac PASS PASS FAIL keyboard-event,particle-2d-normal

@github-actions

Copy link
Copy Markdown

@bofeng-song, Please check the result of run test cases:

Task Details

Platform build boot runned crashScene FailScene
windows PASS PASS FAIL keyboard-event,BuildTimeConstantsTest
android PASS PASS FAIL BuildTimeConstantsTest
wechatgame PASS FAIL FAIL

@minggo minggo merged commit 815c595 into cocos:v3.8.6 Dec 17, 2024
@finscn

finscn commented Dec 20, 2024

Copy link
Copy Markdown
Contributor

看了下pr内容. 感觉这个bug是底层最初设计就有问题. 该用application context的地方, 错误的使用了Activity. 如果是这样, 那这个bug岂不是已经存在好几年了, 从cocos支持安卓开始就有? 之前没人反馈过吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants