Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ IDEA Android Database Sync Not Happening

I am using Intellij IDEA 13 Ultimate for Android Development. As you may know, they offered a nice plugin which connects to installed Android application database and allows you to modify its data or schema and later you can click on the sync button to send all these changes to the device. (or this is what it supposed to do at least)

For some reason this is not happening to me. I am connected to the device and changing some data and click on it but it seems it performs some updates, even I get the updated data when I connect and sync again but nothing happening in the UI? Any ideas why? For example, I have a list shown on the UI and after I change its title from database using this tool, it doesn't reflect anything to the UI even if I completely destroy the app from Task Manager and re-open it.

enter image description here

Update 1:

So I've tried Upload button but this is the error I received:

Data Source Synchronization Error Cannot upload 'Android SQLite': /system/bin/sh: cannot create /data/data/com.something.someapp/databases/someappdb: Permission denied

so I guess this means, it is not really working.

like image 289
Tarik Avatar asked Mar 22 '23 04:03

Tarik


1 Answers

I made it work within the emulator. Here are the steps I followed:

  1. Mark your application as android:debuggable="true". Check this link to see how. (But it seems this is not a necessary step since ADT does that for you automatically when you are in the debug environment.)
  2. It seems you should use either a rooted device (if you're using your physical device for testing) or an emulator which I guess rooted by default.
  3. Sync button in the picture in the question retrieves data in one way which is from remote database to local database. Any changes will remain in the local database unless you click on Upload button which appears when you right click on the database you're connected to.
  4. Once you uploaded your database, you need to remove the application from Recent Activities which is a list appearing when you hold on Home button for couple of seconds.
  5. Once you removed it from Recent Activities, go ahead and start your application again and you are supposed to see the new changes in your database reflected to your UI.

Note: In order to use this feature you should be using IntelliJ Ultimate Edition.

IntelliJ IDEA team talks about this Android SQLite Viewer in this link but they say it should work with unrooted devices doesn't sound right though.

My question is now how I am supposed to make it work with an unrooted device because when I try that I get the following error in IntelliJ IDEA:

Data Source Synchronization Error Cannot upload 'Android SQLite': /system/bin/sh: cannot create /data/data/com.something.someapp/databases/someappdb: Permission denied

I would welcome all the answers but in case I find the answer by myself again, I will post it here, no worries!

like image 117
Tarik Avatar answered Apr 01 '23 17:04

Tarik