gpt4 book ai didi

java - 错误 : Upgrade Fragment version to at least 1. 3.0。 [InvalidFragmentVersionForActivityResult]

转载 作者:行者123 更新时间:2023-12-04 11:47:13 37 4
gpt4 key购买 nike

我在 java android 中有以下使用谷歌代码登录。

private void signIn() {
Intent signInIntent = mGoogleSignInClient.getSignInIntent();
someActivityResultLauncher.launch(signInIntent);
}

ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
if (result.getResultCode() == Activity.RESULT_OK) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(result.getData());
handleSignInResult(task);
}
}
}
);
我得到这个 linting 错误。应用程序确实在设备上运行。但我想解决这个问题。
/home/runner/work/etu-android/etu-android/app/src/main/java/com/encycode/etus/Login.java:151: Error: Upgrade Fragment version to at least 1.3.0. [InvalidFragmentVersionForActivityResult]
ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
^

Explanation for issues of type "InvalidFragmentVersionForActivityResult":
In order to use the ActivityResult APIs you must upgrade your
Fragment version to 1.3.0. Previous versions of FragmentActivity
failed to call super.onRequestPermissionsResult() and used invalid
request codes
我正在使用以下库版本
implementation "androidx.fragment:fragment:1.3.1"

最佳答案

这是 known issue这已经为下一个版本修复了。您可以等待该版本发布或取消警告。
编辑 : Fragment 1.3.2已发布并声明:

Fragment now depends on Activity 1.2.2, fixing an issue with Activity’s InvalidFragmentVersionForActivityResult lint check when using Fragment 1.3.1 or higher.


所以你应该升级到 Fragment 1.3.2。

关于java - 错误 : Upgrade Fragment version to at least 1. 3.0。 [InvalidFragmentVersionForActivityResult],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66740314/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com