[英]do i have every time to change the database number even if i did not make any changes to my database structure to be published to google play store
I have published my android app in google play store it works fine and perfect(my app first will go and create a sqlite DB using SQLiteOpenHelper class then the index.html page will be displayed) then i noticed that users with android version 2.3.6 have error when they install the app i solved the problem without changing or adding to the structure of the DB then after publishing the new version of my app without changing the version of the database my app will not show the index.html and i think it will keep trying creating the database and the user will just see the loading message only. 我已经在google play商店中发布了我的android应用程序,它运行良好且完美(我的应用程序首先将使用SQLiteOpenHelper类创建一个sqlite数据库,然后将显示index.html页面),然后我注意到使用Android版本2.3.6的用户当他们安装应用程序时出现错误,我在不更改或不添加数据库结构的情况下解决了问题,然后在发布了新版本的应用程序而未更改数据库版本后,我的应用程序将不会显示index.html,我认为将继续尝试创建数据库,而用户仅会看到加载消息。 So do i have every time to change the database number even if i did not make any changes to my database structure to be published to google play store. 因此,即使我没有对要发布到Google Play商店的数据库结构进行任何更改,我也有时间更改数据库编号吗?
No, you only change the database version number to a higher version ONLY if you change the structure of the database or decide to automatically add data. 不可以,仅在更改数据库结构或决定自动添加数据时,才将数据库版本号更改为更高版本。
For example, you can start with version 1 with a database that contains only one table: let's call it User
, and the table has a column called Username
. 例如,您可以从版本1开始,其数据库仅包含一个表:让我们将其称为User
,并且该表有一个名为Username
的列。 You run the query to create the table on your onCreate
method. 您运行查询以在onCreate
方法上创建表。 Then you release the app. 然后,您释放该应用程序。
Then you decide to add more features to the app, and implement a version of the app that did not require any database changes at all. 然后,您决定向该应用程序添加更多功能,并实现不需要任何数据库更改的应用程序版本。 Your db version stays 1. 您的数据库版本保持1。
Then on your next app version, you decide to add a column to the User
table. 然后,在下一个应用程序版本上,您决定在“ User
表中添加一列。 So what you do, is increment the db version to 2, and then run the alter table
statement on your onUpgrade
method. 因此,您要做的是将数据库版本增加到2,然后在onUpgrade
方法上运行alter table
语句。 Then you release the app. 然后,您释放该应用程序。
I believe your issue lies somewhere else. 我相信您的问题出在其他地方。 Check your database data integrity and that it fits your app's model. 检查数据库数据的完整性以及是否适合您的应用程序模型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.