I have an android app and i want to download blob storage from Azure.I have a connection String but when i try to parse it ,my app gives me error and my app crash.How can i solve this?
Github Link
Activity which parses connection string:
package com.berkkarabacak.mspproje;
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.TextView;
import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.blob.CloudBlobClient;
import com.microsoft.azure.storage.blob.CloudBlobContainer;
import com.microsoft.azure.storage.blob.ListBlobItem;
public class Checkactivity extends ActionBarActivity {
String tcnumara;
public static final String ConnectionString =
"DefaultEndpointsProtocol=http;"
+ "AccountName=CENSORED;"
+ "AccountKey=CENSORED";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.checkheartbeat);
try
{
// Retrieve storage account from connection-string.
CloudStorageAccount storageAccount = CloudStorageAccount.parse(ConnectionString);
catch (Exception e)
{
// Output the stack trace.
e.printStackTrace();
}
}
}
Logcat:
04-14 14:32:02.598 27372-27372/com.berkkarabacak.mspproje E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.berkkarabacak.mspproje, PID: 27372
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLOutputFactory;
at com.microsoft.azure.storage.core.Utility.<clinit>(Utility.java:120)
at com.microsoft.azure.storage.CloudStorageAccount.parse(CloudStorageAccount.java:239)
at com.berkkarabacak.mspproje.Checkactivity.onCreate(Checkactivity.java:36)
at android.app.Activity.performCreate(Activity.java:6283)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.stream.XMLOutputFactory" on path: DexPathList[[zip file "/data/app/com.berkkarabacak.mspproje-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at com.microsoft.azure.storage.core.Utility.<clinit>(Utility.java:120)
at com.microsoft.azure.storage.CloudStorageAccount.parse(CloudStorageAccount.java:239)
at com.berkkarabacak.mspproje.Checkactivity.onCreate(Checkactivity.java:36)
at android.app.Activity.performCreate(Activity.java:6283)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
at android.app.ActivityThread.access$900(ActivityThread.java:177)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1389)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1184)
Suppressed: java.lang.ClassNotFoundException: javax.xml.stream.XMLOutputFactory
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 17 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
04-14 14:32:04.528 27372-27372/com.berkkarabacak.mspproje I/Process﹕ Sending signal. PID: 27372 SIG: 9
Looking at your gradle build file it looks like you're using the Java Storage library rather than the Android Storage library. If you take a look at the GitHub landing page for the Android storage library there should be directions for importing the Android aar via your gradle build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With