How to manually transfer entire Whatsapp installation to another device (the hard way)


Question

I'm using Whatsapp from a virtual machine since I lost my phone, and now need to transfer it to a new VM.



The easy way would be to use the backup feature native to Whatsapp, but it is disabled since the VM is connected via Ethernet (and Android thinks it's a Mobile connection). In fact the very "local backup" feature is not available. I have a ton of messages which I really wouldn't like to lose.



There's an Xposed module which could possible fake an Wifi connection in the Android VM, but at this point I really want to do the entire transfer locally as my internet is painfully slow right now.



I tried the built-in adb backup feature, only to find out it's disabled for Whatsapp and can't be easily enabled (requires decompiling the apk file).



So, how can I manually transfer Whatspp app data to the new "device"? What folders do I need to copy, and what files must be modified in order for the transfer to work seamlessly?



I do of course have full root access.



[Update] Neither of the following work:




  • Copying the entire contents of /data/data/com.whatsapp/databases after installing Whatsapp, signing in and closing it. It will crash when opening, without any error message.


  • Copying the same directory, but without opening Whatsapp and signing in after installation. Same error as above.


  • Copying /data/data/com/whatsapp/databases/msgstore.db after installing Whatsapp and signing in. An error message is presented: "Something went wrong with your chat history"


  • Copying the entire /data/data/com.whatsapp directory, after installing and closing it. It will crash when opening, without any error message.



Answer

I was encountering the crashing behaviour trying these approaches too, but @DeathMaskSalesman seems to've been on the right track—the crashes are indeed a permissions issue.



If you remove WhatsApp entirely, reinstall it, and copy /data/data/com.whatsapp over and adjust the permissions correctly before launching it the first time, then it should just need to reverify your number to work. This worked for me.



To adjust permissions, first use ls -la to check the permissions on what's put in the /data/data/com.whatsapp directory upon install, e.g.:



drwxrwx--x
3 u0_a105 u0_a105  4096 2018-07-14 00:55 cache


Then use the username and group (here both u0_a105) to rename the files after you've copied them in:



chown -R u0_a105:u0_a105 /data/data/com.whatsapp/*


Then WhatsApp should launch okay without crashes, and retain settings, messages, and multimedia.


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes