Error:litepal.InvalidAttributesException: the version of database can not be less than 1

  • 发现问题:

在学习的过程中出现了一个错误,提示为数据库版本不能小于1。

Error Log:

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.example.litepaltest, PID: 23737
                  org.litepal.exceptions.InvalidAttributesException: the version of database can not be less than 1
                      at org.litepal.parser.LitePalAttr.checkSelfValid(LitePalAttr.java:205)
                      at org.litepal.tablemanager.Connector.buildConnection(Connector.java:105)
                      at org.litepal.tablemanager.Connector.getWritableDatabase(Connector.java:63)
                      at org.litepal.tablemanager.Connector.getDatabase(Connector.java:87)
                      at com.example.litepaltest.MainActivity$1.onClick(MainActivity.java:22)
                      at android.view.View.performClick(View.java:5198)
                      at android.view.View$PerformClick.run(View.java:21147)
                      at android.os.Handler.handleCallback(Handler.java:739)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:148)
                      at android.app.ActivityThread.main(ActivityThread.java:5417)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Error:litepal.InvalidAttributesException: the version of database can not be less than 1

  • 问题成因:

版本配置为2

Error:litepal.InvalidAttributesException: the version of database can not be less than 1Error:litepal.InvalidAttributesException: the version of database can not be less than 1

litepal引用

Error:litepal.InvalidAttributesException: the version of database can not be less than 1

  • 问题解决:

Version 语句有问题;默认认为未进行配置,此处出现小于1的情况为未配置。