Some Problems of Cocos porting to Android-SQLite3 database porting problem, android-sqlite3
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.
<Game engineering directory> \ 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 official website, copy the sqlite3.h and sqlite3.c files to the project's Classes directory, and then open the <game project directory> \ 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 the Cocos2d-x Technology Discussion Group: 257760386 welcome to the knowledge of the iOS classroom public platform