1. First, find the position of Android SDK in this machine. If you don’t know, you can find it at Android Studio, as follows::
2, followed by CMD, open the Windows command line window. If the directory where the SDK is located is under the C drive, you can directly mount it to the PLATFORM-Tools directory under the SDK directly through the CD command, as follows: below:
cd C:\Users\wyj\AppData\Local\Android\Sdk\platform-tools
If in other disks (such as D disks), you need to transfer to the disk first:
and then use the CD command to turn to the corresponding position
3, continue, enteradb shell
command, if the prompt is wrong, it may be because the simulator may not be opened. You can run the simulator in Android Studio
4, then enter the commandsqlite3
, you can use SQLite3 database
5. Use.exit
command to exit SQLite interactive mode
Detailed steps are as follows:
Another:
You can double-click the SQLite3.exe file under the SQLite3.exe file under the path of Android \ SDK \ Platform-Tools path directly into the final command above!
~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~ ~~
1. Create a directory DataBase to save the database file:
\Android\Sdk\platform-tools
Under the command, enter the following command in turn-
adb root
adb remount
Display at this timeremount succeeded
means successful, you can make the next step
[If promptadb Not running as root. Try "adb root" first.
, because the selected simulator does not have ROOT, it is best to change a simulator with Google APIS at this time. For details, please refer to this article:Click to view】
Then enter the following command in turn-
adb shell
mkdir /data/data/com.example.actualcombatbasis/database
【 Note-> Abovecom.example.actualcombatbasis
is your Android project package name, you have to change to your own, do not fully copy it;database
means a folder you want to create, you can customize]
Detailed steps are as follows:
View effect:
2. Create or open the database (DB_FIRST):
After theadb shell
command executes, execute the following commands in turn:
cd /data/data/com.example.actualcombatbasis/database
Note: com.example.actualcombatbasis is your project package name, database is the package where you created, and the default in AS is DataBases.
sqlite3 db_first
Note: Open the database is also the command above
3. Create a database table (user):
create table user (id integer primary key autoincrement,name text not null,pwd text);
4, query all tables:
.tables
5. Insert data into the database table:
insert into user values(null,'wyj','123456');
6, query content in the table:
select * from user;
detailed steps are as follows:
4 Please like it |
(●ˇ∀ˇ●) |