How to use adb command to push a file on device without sd card

后端 未结 13 1701
南笙
南笙 2020-12-04 07:44

How to push a file from computer to an Android device having no SD Card in it. I tried:

C:\\anand>adb push anand.jpg /data/local
3399 KB/s (111387 bytes in         


        
13条回答
  •  自闭症患者
    2020-12-04 07:53

    My solution (example with a random mp4 video file):

    1. Set a file to device:

      adb push /home/myuser/myVideoFile.mp4 /storage/emulated/legacy/
      
    2. Get a file from device:

      adb pull /storage/emulated/legacy/myVideoFile.mp4 
      

    For retrieve the path in the code:

    String myFilePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/myVideoFile.mp4";
    

    This is all. This solution doesn't give permission problems and it works fine.

    Last point: I wanted to change the video metadata information. If you want to write into your device you should change the permission in the AndroidManifest.xml. Add this line:

    
    

提交回复
热议问题