Https://github.com/LitePalFramework/LitePal
Reference documents
http://blog.csdn.net/guolin_blog/article/details/38556989
Software: Android Studio
Referring to a bunch of data, the final discovery is basically a tune, as if no one encountered any problems. In fact, in the first use of the process, there will be some inexplicable errors. Finally, read the English on GitHub and find out that the wrong is so outrageous
The packages downloaded from the official website contain many of these jar packages.
Just think, the recent package copy into it, a hand residue, the Litepal-1.3.1.jar and Litepal-1.3.1-src.jar package are copied into Libs, so the problem came, follow the online process, out of a bunch of unknown errors. In fact, in a word, it is conflict.
Baidu found a lap, unexpectedly no one has encountered this problem, silently squat corner to see Chinese go
Crossing Network Interpretation
That is, a class file, a class file and a Java file synthesis.
The whole person is not good, will litepal-1.3.1.jar delete is OK.
Right Button-"Add as library"
Waiting .......
Observe Build.gradle
OK, almost halfway through.
Next, configure the Litepal.xml
Create a new Litepal.xml file in the project's assets directory
Configured as follows
Where dbname is the name of the database, version is the database and is used for database upgrade
List is a mapping function, <mapping class= "Com.test.model.Reader" ></mapping>
Com.test.model is the package name
Reader is the table name
Configuring the Androidmanifest.xml File
I understand that the role of header files in C should be the same as
At the beginning, import two jar package, will appear org.litepal.LitePalApplication red, error, delete one, and the Build.gradle file in the associated file deleted, OK, hand remnants ah, did not understand the principle, copy the results of the suit.
Finally, in the OnCreate file in activity, create a database to
Sqlitedatebase db = Connector.getdatabase ();
Create a table, build a class, name news
Complete
You can see if the creation was successful through the teiminal that comes with Android studio
View the database table structure
Using an open source database in an Android project Litepal