Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

适配Android 14步骤(AndroidX 版本) #176

Open
koala0x opened this issue Aug 18, 2024 · 1 comment
Open

适配Android 14步骤(AndroidX 版本) #176

koala0x opened this issue Aug 18, 2024 · 1 comment

Comments

@koala0x
Copy link

koala0x commented Aug 18, 2024

  1. 使用这个文件夹下的代码 ‘LiveEventBus-master/branchs/live-event-bus-x’
  2. 把原有的‘implementation 'com.jeremyliao:live-event-bus-x:1.7.3'’依赖包下的‘LiveEventBus’类粘贴到‘LiveEventBus-master/branchs/live-event-bus-x’目录下的‘LiveEventBus’类上, 替换掉(作者原有包下的代码和文件夹下的代码有点不一样, 替换下就好了).
  3. 将‘live-event-bus-x’的‘build.gradle’中的‘targetSdkVersion’提升到34
  4. 将‘live-event-bus-x’下面的‘com.jeremyliao.liveeventbus.core.LiveEventBusCore’类下的‘registerReceiver()’方法里的替换下就可以了, 原作者打了几个版本的包, 现有代码有的部分又与打的包不一样, 有的热心的同学打的包就没用上.
    ’‘’
    void registerReceiver() {
    if (isRegisterReceiver) {
    return;
    }
    Application application = AppUtils.getApp();
    if (application != null) {
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(IpcConst.ACTION);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
    application.registerReceiver(receiver, intentFilter, RECEIVER_EXPORTED);
    } else {
    application.registerReceiver(receiver, intentFilter);
    }
    // application.registerReceiver(receiver, intentFilter);
    isRegisterReceiver = true;
    }
    }
    ‘’‘
@w-xuedinger
Copy link

implementation 'com.jeremyliao:live-event-bus-x:1.7.3
这个包好像没了,能贴一下LiveEventBus源码吗

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

No branches or pull requests

2 participants