Writeable SD Card Emulation for Android Emulators

 This guides show how to create, populate, and load an emulated SD card for use with an Android emulator.  


Create a .img File on the Local Filesytem

# create the .img file and populate with photos to post to instagram
onebeartoe@betoland /cygdrive/c/home/backup/world/3d-printing/animals/owl
$ ll /dev/zero
crw-rw-rw- 1 onebeartoe Domain Users 1, 5 Aug 24 11:23 /dev/zero

onebeartoe@betoland /cygdrive/c/home/backup/world/3d-printing/animals/owl
$ dd if=/dev/zero of=instagram.img bs=1M count=50
50+0 records in
50+0 records out
52428800 bytes (52 MB, 50 MiB) copied, 0.115103 s, 455 MB/s

# make sure the 'e2fsprogs' package is installed via Cygwin

# verify the mksf command is available from 'e2fsprogs'
onebeartoe@betoland ~
$ ll /usr/sbin/mkfs.ext3



# formmat the .img card with a fat32 filesystem
$ /usr/sbin/mkfs.ext3 -L instagram instagram.img


# make a directory for mounting the image file
$ mkdir instagram-mount

# The .img file was not mountable with the 'mount' executable that Cygwin provides                    


Mount the .img File to Add Files

# obtain mounting software and mount the .img

	http://www.osforensics.com/tools/mount-disk-images.html

	Mount the .img withthe osforensics software and specify drive letter.

	
# Populate the Drive with Photos
	
	Go to the drive letter specidied inthe previous step (I: for example) and add photots.
	
	dismount the drive via the OSFMount tool


Setup Android Studio and Install a AVD (Android Virtual Device)

This profile works nicely with this project

    Android SDK Platform 21 
    Lollipop  Andoid 5.0 - API level 21

    From AVD manager:
    Name: Nexus_5X_API_21_3
    CPU/ABI: Google APIs Intel Atom (x86)
    Target: google_apis [Google APIs] (API level 21)
    image.androidVersion.api: 21
    avd.ini.displayname: Nexus 5X API 21 3


Install Instagram APK

this guide used the APK from

http://www.apkmirror.com/apk/instagram/instagram-instagram/instagram-instagram-7-12-1-18439032-release/instagram-7-12-1-18439032-android-apk-download/download/

The APK that finally worked on this platform is named 


com.instagram.android_7.12.1-18439032_minAPI16-x86-nodpi.apk


If you get an INSTALL_FAILED_NO_MATCHING_ABIS error, make sure the appropriate
CPU architecure is used (ARM based processor for the AVD) (x86 based processor for Intel types).


Copy and Paste Text from PC to Android Emulator

Make sure the emulator is running, then issue these commands.

    $ adb shell input text 'thetextyouwanttopaste'
    
    with spaces
    
    $ adb shell input text "'I%s<3%shttp://www.onebeartoe.net/3d-printing/animals/owl/low-poly/'"


Publish to Instagram from a Desktop Operating System

	add the image to post to the SD card on the PC file system that the emulator uses

	start an emulator for an Android device 
	
		use the 'AVD Manager' icon in Android Studio IDE to start 'Nexus_5X_API_21' from above.			
		
		or start it from the command line

	run the onebeartoe tool for Android text copying to an emulator
	
		$ cd github/software-development-tools/android/adb-tool
		$ java -jar target/adb-tool-0.0.1-SNAPSHOT.jar

	start an app that can share to Instagram
	
	select a file to upload from the emulated SD card
	
	move the UI context in the Android emulator to the Description text area
	
	type the description text into the onebeartoe text copying app
	
	click the Send button on the onebeartoe text copying app	


Resources

    1) creating .img files
    
        http://ubuntuhak.blogspot.com/2012/10/how-to-create-format-and-mount-img-files.html

    2) mksdcard

        https://developer.android.com/studio/command-line/mksdcard.html
        
    3) Copy and Paste Text to Android Emulator
    
            http://stackoverflow.com/questions/3391160/paste-text-on-android-emulator


Date Created: 2016-09-26 22:15:22 -0500 (Mon, 26 Sep 2016)


back    |    top