[problem] sqlite3 is not used for android? I got a sqlite3.c and header file!

iphone is ok. but android ndk is not build with sqlite3.c

I don’t understand Why NDK is want sqlite3.o

so. I make a sqlite3.o but that was rejected.

OH MyGOD. that is a build log.

Compile++ thumb : game_shared <= Skill.cpp
make: *** No rule to make target jni/jni/../../Classes/sqlite3.c', needed byobj/local/armeabi/objs/game_shared/jni///Classes/sqlite3.o’. Stop.
make: Leaving directory `/Project/ProjectA/Client/DochiDream/proj.android’

and it is my android.mk

LOCAL_SRC_FILES := hellocpp/main.cpp
$(SOURCE_FILES)
$(LOCAL_PATH)/…/…/Classes/sqlite3.c \

I do not know if you have solved this issue, but the solution is to add it as follows on your Android.mk (and only this line, without nothing else I got it working)

LOCAL_SRC_FILES := hellocpp/main.cpp \
                   ../../Classes/sqlite3.c \

I hope at least it helps someone else searching for the same problem :slight_smile: (that is how I arrived to this post )

SangTaik Jung wrote:

iphone is ok. but android ndk is not build with sqlite3.c
>
I don’t understand Why NDK is want sqlite3.o
>
so. I make a sqlite3.o but that was rejected.
>
OH MyGOD. that is a build log.
>
Compile++ thumb : game_shared <= Skill.cpp
make: *** No rule to make target `jni/jni/…/…/Classes/sqlite3.c’, needed by `obj/local/armeabi/objs/game_shared/jni///Classes/sqlite3.o’. Stop.
make: Leaving directory `/Project/ProjectA/Client/DochiDream/proj.android’
>
>
and it is my android.mk
>
LOCAL_SRC_FILES := hellocpp/main.cpp > $ > $/…/…/Classes/sqlite3.c
<pre>
sqlite3**pdb=NULL;
std::string path = CCFileUtils::sharedFileUtils->fullPathForFilename;
#if CC_TARGET_PLATFORM CC_PLATFORM_ANDROID
path = CCFileUtils::sharedFileUtils()->getWritablePath();
path += “/Question.db3”;

            FILE\* file = fopen(path.c\_str(), "r");
            if (file  NULL)

{
unsigned long size;
const char** data = (char*) CCFileUtils::sharedFileUtils()->getFileData(“Question.db3”, “rb”, &size);
file = fopen(path.c_str(), “wb”);
fwrite(data, size, 1, file);
CC_SAFE_DELETE_ARRAY(data);
}
fclose(file);
#endif

int result;
result=sqlite3_open(path.c_str(),&pdb);
if(result!=SQLITE_OK)
CCLog(“open database failed, number%d”,result);