我们正在尝试从 java 客户端应用程序 (Android) 访问 azure blob 存储。 以下教程对此进行了解释:Tutorial Blob Java
从 Eclipse 启动应用程序时出现异常。 “找不到从方法 com.microsoft.windowsazure.services.core.storage.utils.utility.createXMLstreamReaderFromReader 引用的方法 javax.xml.stream.xmlinputfactory.newinstance”。
azure 似乎正在使用 android 中不存在的 XML 库。
下面是代码 fragment :
public static final String storageConnectionString =
"DefaultEndpointsProtocol=http;" +
"AccountName=myaccountname;" +
"AccountKey=myaccountkey";
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
FileOutputStream FileXml = null;
// Retrieve storage account from connection-string
try {
CloudStorageAccount storageAccount = CloudStorageAccount.parse(storageConnectionString);
// Create the blob client
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
// Get a reference to a container
// The container name must be lower case
CloudBlobContainer container = blobClient.getContainerReference("weetjesandroid");
最佳答案
作为解决方法,您可以使用 Android 的 HttpURLConnection直接访问Blob Service REST API .
阅读Authentication for the Windows Azure Storage Services了解如何提供所需的 Authorization
请求 header 。
您必须编写更多代码并了解如何调用所需的 API,但我可以证明这种方法是有效的。
关于android - Azure 云存储帐户 Android : Acces blob from android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17486532/