gpt4 book ai didi

Android IllegalAccessError 到我的类方法

转载 作者:行者123 更新时间:2023-12-03 05:38:48 25 4
gpt4 key购买 nike

我在我的类方法中遇到了与 IllegalAccessError 相关的问题(仅在 Android 8 设备上)

我更新了:

  • Android Studio 到 3.3
  • Gradle 到 3.3.0 的 Android 插件
  • 升级到 4.10.1

  • 这是我的课:
    public class ShareDialogFragment extends BottomSheetDialogFragment {

    @Nullable
    @Override
    public View onCreateView(final @NonNull LayoutInflater inflater, @Nullable final ViewGroup container, @Nullable final Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_share, container, false);
    ButterKnife.bind(this, rootView);
    readArguments();

    return rootView;
    }

    private void readArguments() {
    if (getArguments() != null) {
    sharedImageGridId = getArguments().getLong(Constants.Extra.SHARED_IMAGE_GRID_ID);
    isReadyToShare = getArguments().getBoolean(Constants.Extra.SHARED_IMAGE_IS_READY);
    } else {
    listener.onShareError(R.string.main_activity_share_photo_error);
    }
    }
    }

    这是崩溃堆栈跟踪:
    Fatal Exception: java.lang.IllegalAccessError: Method 'void com.jsdev.instasize.fragments.ShareDialogFragment.readArguments()' is inaccessible to class 'com.jsdev.instasize.fragments.ShareDialogFragment' (declaration of 'com.jsdev.instasize.fragments.ShareDialogFragment' appears in /data/app/com.jsdev.instasize-Bj_BEi7m9Z2r1b0gV7ktkQ==/base.apk)
    at com.jsdev.instasize.fragments.ShareDialogFragment.onCreateView(ShareDialogFragment.java:97)
    at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
    at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
    at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)

    因此在 ShareDialogFragment 类中无法访问 readArguments() 方法。

    谷歌搜索并没有帮助找到答案。

    有什么建议么? :)

    最佳答案

    尝试更改您的私有(private)方法

    private void readArguments() {

    公开方法为
    public void readArguments() {

    关于Android IllegalAccessError 到我的类方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54326248/

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