Android: An Application Activity to create an AVD
Can the Android API provide all the details req开发者_如何学Gouired to make an AVD?
Premise being, if it can, could an Android create an AVD of itself?
No, not using the framework APIs and not without a modified device.
You'd need to construct a userdata.img file, which is essentially a block-level copy of the device's user-writable storage. However, you do not have block-level access to the filesystem.
On top of that, your application wouldn't have permission to read much of the filesystem.
Now, if you wanted to create a blank AVD, then you might be able to do that (but why?). That's because the requirements to create an AVD are pretty basic.
You'd also need a system.img file, and you don't have the permission to create that from the device either. (There may also be legal issues involved here, which I will not discuss.)
I'm not sure but if it isn't in Googles docs then it probably isn't possible http://developer.android.com/guide/developing/tools/avd.html Seems like you'll have to do it all manually. although if you have a phone at your disposal that you wish to copy, the best decision would be to debug directly on the phone itself
You mean, an Android app being executed on a device (or in the emulator), can it create another instance of the emulator on the host PC? I'd do it in a desktop program, then find a way to invoke it from Android.
I don't get what you're trying to do. An AVD is useful with an emulator, but there is no emulator that runs on Android hardware. Perhaps you're thinking of making a complete copy of the "disk" that is the Android device? For that you'd need root access, and somewhere to write it to. Something like dd that writes to the network somehow. Is that what you're thinking?
精彩评论