$ exit # Closes the shell started with run-as This leverages run-as which allows you to impersonate your package's user to make the change. The first block configures the permissions of your database to be readable. $ adb pull /data/data//databases/database_name # Exit and pull from the terminal on your PC $ cp /data/data//databases/database_name If the cp command isn't working for you try one of the following instead: # Pick a writeable directory other than /sdcard $ chmod 660 databases/database_name # Optional $ cp /data/data//databases/database_name /sdcard Simplest method when not using an emulator $ adb shell So, now may be a good time to make the switch. Flipper already has many of the features that Stetho has. You can now use Stetho to view Couchbase documents: įacebook is focusing efforts on adding all Stetho features into its new tool, Flipper. You can now use Stetho to view Realm files (if you're using Realm instead of an SQLite DB): It only requires a little setup: 1 gradle dependency addition (which you can comment out for production builds), a few lines of code to instantiate Stetho, and a Chrome browser (because it uses Chrome devtools for everything). On the actual website, they also talk about features for network inspection and looking through the view hierarchy. I've used Stetho on several occasions for different purposes (one of them being database inspection). I'm actually very surprised that no one has given this solution: List all of the available SQLite prompt commands. Print the entire table: SELECT * FROM tablename There are a few steps to see the tables in an SQLite database: dbĦ- run sqlite3 commands that you like eg: Select * from table1 where. I haven't found any way to do that in Android Studio, but I access the db with a remote shell instead of pulling the file each time.ġ- Go to your platform-tools folder in a command promptĢ- Enter the command adb devices to get the list of your devices C:\Android\adt-bundle-windows-x86_64\sdk\platform-tools>adb devicesģ- Connect a shell to your device: C:\Android\adt-bundle-windows-x86_64\sdk\platform-tools>adb -s emulator-xxxx shellĤ- Navigate to the folder containing your db file: cd data/data//databases/ĥ- run sqlite3 to connect to your db: sqlite3. It goes without saying however that you should undo all these steps before publishing your app. Go to this Github repository and follow the instructions in the readme to be able to view your database on your device. You can now view the contents of your database. Click on ' open database', navigate to the location you saved the database file, and open. Now, open the SQLiteBrowser you installed. Right click on the database and select Save As. Go to data > data > PACKAGE_NAME > database, where PACKAGE_NAME is the name of your package (it is com.Movie in the example above) Open Device File Explorer via View > Tool Windows > Device File Explorer Click on the ' pull a file from the device' button:Ī window will open asking you where you want to save your database file. Go to the top right corner of the Android Device Monitor window. Select the database by just clicking on it. Go to File Explorer (one of the tabs on the right), go to /data/data/databases Copy the database from the device to your PC:Īndroid Studio versions Android > Android Device Monitor
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |