Here is the code to connect the database named "library.db" in the assets file.
public abstract class DBConstant {
//database file directory
public static String DATABASE_PATH = "/data/data/(pack_name)/databases";
//database file name
public static String DATABASE_FILE = "library.db";
//database version
public static int DATABASE_VERSION = 1;
}
However, in my laptop, the laptop with windows or the laptop with mac os, the app cannot find the .db file. After edit the /databases
to /assets
, all goes well. Another weird is that when I edit it back to /databases
, it goes well on my laptop with windows, but become failed on other laptops.
What can that happen? There seems no difference in other codes.