2015年2月8日 星期日

Android Studio -Tutorial (Copy file into the sdcard of emulator)

Ref: 
1. https://diptimayapatra.wordpress.com/2013/07/04/copying-a-file-to-sd-card-image-using-adb-exe-for-android-emulator/
2. http://stackoverflow.com/questions/2083709/android-emulator-sdcard-push-error-read-only-file-system


1. Start Emulator.
2. Run command mode by administrator privileges
3. Change platform-tools directory (user as csjou)
C:\WINDOWS\system32>cd C:\Users\csjou\AppData\Local\Android\sdk\platform-tools
4. Follow Ref1 step fails to push file into sdcard.
C:\Users\csjou\AppData\Local\Android\sdk\platform-tools>adb push "C:\Users\csjou
\Pictures\HWUIC.jpg" /sdcard/
failed to copy 'C:\Users\csjou\Pictures\HWUIC.jpg' to '/sdcard//HWUIC.jpg': Read
-only file system
5. Change sdcard read-only status (Follow the command as red characters)
C:\Users\csjou\AppData\Local\Android\sdk\platform-tools>adb shell
root@generic_x86:/ # cd sdcard
cd sdcard
root@generic_x86:/sdcard # ls
ls
root@generic_x86:/sdcard # su
su
root@generic_x86:/storage/sdcard # mount -o rw,remount rootfs /
mount -o rw,remount rootfs /
root@generic_x86:/storage/sdcard # chmod 777 /mnt/sdcard
chmod 777 /mnt/sdcard
root@generic_x86:/storage/sdcard # exit
exit
root@generic_x86:/sdcard # exit
exit
6. 
C:\Users\csjou\AppData\Local\Android\sdk\platform-tools>adb push "C:\Users\csjou
\Pictures\HWUIC.jpg" /sdcard/
1388 KB/s (31311 bytes in 0.022s)

沒有留言:

張貼留言