0

I am testing a HarmonyOS application and want to add an image to the emulator's gallery.

In Android Studio, we can send any file into the android emulator via drag-n-drop action, but drag-n-drop isn't working here.

What is the alternative for this in HarmonyOS?

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
Jaswanth
  • 31
  • 7

2 Answers2

1

Welcome to the community!

You can transfer files in HarmonyOS Simulators from your computer via the following command, images will appear in Gallery once pushed -

Steps:

  1. Make sure the device (Simulator / Phone) is running.

  2. Run DevEcoStudio -> Open Terminal.

  3. Make sure the Device is connected to DevEcoStudio.

  4. Make sure you have HMOS_Home set in environment variables in your computer.

  5. Run hdc file send command with arguments. The terminal will show messages with success or failure after execution.

    hdc file send [LOCAL file path of computer] [REMOTE location in device]

Example - enter image description here

Kanak Sony
  • 1,570
  • 1
  • 21
  • 37
0

Currently, drag-and-drop is not supported. You can run the following HDC command to transfer files:

hdc file send D:/a.jpg /sdcard

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108