Giter Site home page Giter Site logo

keyvaluex's Issues

报错ClassCastException

我的这个错误是混淆没有关系,是因为没有生成具体的实现类有关。请问这个有什么解决办法吗?

如何清除缓存?

比如有这么个场景,用户退出登录需要清空key-value,目前没有暴露这个方法吧,是直接调用 SPUtils.getInstance().clear()

存储内核支持可换就好了

我看源码,底层存储使用的还是SP,要是能支持替换为MMKV,或者DataStore就好了。应该提供一组接口,让使用者自行设置内核,不设置才使用默认的SP。

使用时报错:ClassNotFoundException & ClassCastException

我尝试着集成在项目中测试,在启动 Activity 发现会报 java.lang.ClassNotFoundException: com.xxx.xxx.xxx.ConfigsImpl 的错误,集成使用方式如下:

implementation 'com.github.KunMinX.KeyValueX:keyvalue:3.2.0-beta'
annotationProcessor 'com.github.KunMinX.KeyValueX:keyvalue-compiler:3.2.0-beta'
@KeyValueX
public interface Configs {
    KeyValueBoolean isLogin();
}
public class WelcomeActivity extends AppCompatActivity {

    Configs configs = KeyValueProvider.get(Configs.class); // 这行会报错

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        ...

        LogUtils.wLog().e("isLogin=" + configs.isLogin().get());
        configs.isLogin().set(!configs.isLogin().get());
    }
}

并且 crash:
Caused by: java.lang.ClassCastException: java.lang.Object cannot be cast to xxx.xxx.xxx.Configs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.