In an Android app, using NDK, I’m accessing a local file using fopen, fclose, etc. My app started out as HellloJNI (the supplied example). Accessing the file actually worked initially. The file path I used was "/data/data/com.example.hellojni/files/Test.txt".
Naturally I don’t want my app to be called HelloJNI forever, so I changed the package name (manifest/@package in AndroidManifest.xml) from com.example.hellojni to com.example.mytest. Accordingly, I use a different file path: "/data/data/com.example.mytest/files/Test.txt". But the same call to fopen("[...]", "w+") that used to succeed now fails.
Any ideas?
It works after manually creating the
filesfolder below/data/data/com.example.mytest. In a way, it’s obvious, but I still don’t fully understand it, because I never created explicitly thefilesfolder below/data/data/com.example.hellojni. So where did that one come from?Edit:
Apparently calling
getFilesDircreates theFilesfolder implicitly, so that mystery is solved 🙂