Image from firebase storage into google map marker
<p>I am trying to retrieve an image from firebase and then uploading it into marker icon.
Based on the sample from the firebase tutorial I succeded retrieving the image uri and I can put when I get the uri into an image view it works just fine, then I tried putting it into the marker's icon, but I get the error :</p>

<pre><code>   D/AndroidRuntime: Shutting down VM
E/UncaughtException: java.lang.NullPointerException
                         at maps.f.g.a(Unknown Source)
                         at maps.af.g$a.&lt;init&gt;(Unknown Source)
                         at maps.af.g.a(Unknown Source)
                         at maps.af.R.&lt;init&gt;(Unknown Source)
                         at maps.af.t.a(Unknown Source)
                         at vl.onTransact(:com.google.android.gms.DynamiteModulesB:167)
                         at android.os.Binder.transact(Binder.java:380)
                         at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.addMarker(Unknown Source)
                         at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
                         at com.htaka.mywall.MapsActivity$3.onSuccess(MapsActivity.java:142)
                         at com.htaka.mywall.MapsActivity$3.onSuccess(MapsActivity.java:137)
                         at com.google.android.gms.tasks.zze$1.run(Unknown Source)
                         at android.os.Handler.handleCallback(Handler.java:739)
                         at android.os.Handler.dispatchMessage(Handler.java:95)
                         at android.os.Looper.loop(Looper.java:135)
                         at android.app.ActivityThread.main(ActivityThread.java:5421)
                         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:914)
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
I/DynamiteModule: Considering local module com.google.android.gms.tagmanager:3 and remote module com.google.android.gms.tagmanager:3
I/DynamiteModule: Selected local version of com.google.android.gms.tagmanager
W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
I/GoogleTagManager: Tag Manager initilization took 29ms
D/FirebaseCrashApiImpl: throwable java.lang.NullPointerException
E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: com.htaka.mywall, PID: 1013
                  java.lang.NullPointerException
                      at maps.f.g.a(Unknown Source)
                      at maps.af.g$a.&lt;init&gt;(Unknown Source)
                      at maps.af.g.a(Unknown Source)
                      at maps.af.R.&lt;init&gt;(Unknown Source)
                      at maps.af.t.a(Unknown Source)
                      at vl.onTransact(:com.google.android.gms.DynamiteModulesB:167)
                      at android.os.Binder.transact(Binder.java:380)
                      at com.google.android.gms.maps.internal.IGoogleMapDelegate$zza$zza.addMarker(Unknown Source)
                      at com.google.android.gms.maps.GoogleMap.addMarker(Unknown Source)
                      at com.htaka.mywall.MapsActivity$3.onSuccess(MapsActivity.java:142)
                      at com.htaka.mywall.MapsActivity$3.onSuccess(MapsActivity.java:137)
                      at com.google.android.gms.tasks.zze$1.run(Unknown Source)
                      at android.os.Handler.handleCallback(Handler.java:739)
                      at android.os.Handler.dispatchMessage(Handler.java:95)
                      at android.os.Looper.loop(Looper.java:135)
                      at android.app.ActivityThread.main(ActivityThread.java:5421)
                      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:914)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:707)
W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
I/Process: Sending signal. PID: 1013 SIG: 9
Application terminated.
</code></pre>

<p>I don't know what's the problem... this is the code I am working with and the class I use loadImage to set it into an imageview :</p>

<pre><code>public void setMarkers(DataSnapshot dS ,boolean re) {
        if(re) {mMap.clear();}

        post = dS.getValue(Post.class);

        storageRef.child("mountains.jpg").getDownloadUrl().addOnSuccessListener(new OnSuccessListener&lt;Uri&gt;() {
            @Override
            public void onSuccess(Uri uri) {
                ImageView im=new ImageView(MapsActivity.this);
                GlideUtil.loadImage(uri.toString(),im );
                marker = mMap.addMarker(new MarkerOptions()
                        .position(new LatLng(post.latitude, post.longitude))
                        .title(post.title)
                        .icon(BitmapDescriptorFactory.fromBitmap(im.getDrawingCache()))
                );

            }
        }).addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception exception) {
                System.out.print("image "+exception.getMessage());
                marker = mMap.addMarker(new MarkerOptions()
                        .position(new LatLng(post.latitude, post.longitude))
                        .title(post.title)
                );
            }
        });
</code></pre>

<p>PS : in case I remove the icon(BitmapDescriptorFactry......) the app runs like it should.</p>

<p>here is the loadImage, I got it from the sample in the firebase github section, I tested it and it worked, you basicly send uri with the imageview and it loads it, into the imageview, in case someone is intersted :
<strong>Gradle : compile 'com.github.bumptech.glide:glide:3.6.0'</strong></p>

<pre><code>public class GlideUtil {
    public static void loadImage(String url, ImageView imageView) {
        Context context = imageView.getContext();
        ColorDrawable cd = new ColorDrawable(ContextCompat.getColor(context, R.color.wallet_holo_blue_light));
        Glide.with(context)
                .load(url)
                .placeholder(cd)
                .crossFade()
                .centerCrop()
                .into(imageView);
    }
</code></pre>