Problems with Cocos porting to Android-SQLite3 database migration

Source: Internet
Author: User

Problems with Cocos porting to Android-SQLite3 database migration
First, we will discuss the problem of migrating the SQLite3 database. In section 14th, we introduced the use of the SQLite3 database on the Win32 platform, and we introduced two ways to configure the environment: one is to use the SQLite3 library configuration provided by the Cocos2d-x, the other is to download the source code copy from the SQLite website. The first method is difficult to configure, the key is that the SQLite3 library provided by the Cocos2d-x is only Win32 without other platforms, the directory structure is as follows.
<游戏工程目录> \ Cocos2d \ external \ sqlite3
│ Android. mk

├ ── Include
│ Sqlite3.h
│ Sqlite3ext. h

└-Libraries
─ ── Win32
Sqlite3.dll
Sqlite3.lib
Therefore, we can only use the second method to download the source code compressed package from the SQLite website, copy the sqlite3.h and sqlite3.c files to the project's Classes directory, and then open <游戏工程目录> \ Proj. android \ jni \ Android. mk file. modify the content of LOCAL_SRC_FILES as follows:
LOCAL_SRC_FILES: = hellocpp/main. cpp \
.../../Classes/AppDelegate. cpp \
../Classes/HelloWorldScene. cpp \
.../../Classes/sqlite3.c
Here, sqlite3.c is the append we just added, saving Android. after the mk file, use the Cocos tool for cross-compilation. If we can see the content (cocos2dcpp_shared <= sqlite3.c) during the compilation process, it indicates that sqlite3 has been compiled.


If sqlite3 can be compiled successfully, it means that the transplantation of SQLite3 is successful. We can write the access data code.

We use third-party libraries either header files and source program files, or header files and library files (Dynamic Connection Library. so or static Connection Library. ). For SQLite3 porting, we use header files and source program files.


More content please pay attention to the first domestic Cocos2d-x 3.2 version of the book "Cocos2d-x practice: C ++ volume" book exchange discussion site: http://www.cOcoagame.net
For more exciting video courses, please follow the Cocos course in Zhijie class: http: // v.51wOrk6.com
Welcome to CocZ workshop? Http://www.bkjia.com/kf/ware/vc/ "target =" _ blank "class =" keylink "> assets/zszdzqlqxbmrublgvcyopgltzybzcm9" http://www.2cto.com/uploadfile/Collfiles/20141118/2014111808211856.jpg "alt ="/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.