Android 我尝试加载图像时出错

Android 我尝试加载图像时出错,android,firebase-storage,Android,Firebase Storage,我正试图使用以下代码将图像加载到我的应用程序中,但应用程序不断崩溃,我的logcat中不断出现此错误 在我制作的其他应用程序中运行相同的代码时工作正常,没有错误 即时通讯使用的代码 final StorageReference mImageRef = FirebaseStorage.getInstance().getReference("Profile_image/thumbs/" + image + ".jpg"); final long ONE_MEGABY

我正试图使用以下代码将图像加载到我的应用程序中,但应用程序不断崩溃,我的logcat中不断出现此错误

在我制作的其他应用程序中运行相同的代码时工作正常,没有错误

即时通讯使用的代码

 final StorageReference mImageRef =
            FirebaseStorage.getInstance().getReference("Profile_image/thumbs/" + image + ".jpg");
    final long ONE_MEGABYTE = 1024 * 1024;

    mImageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
        @Override
        public void onSuccess(Uri uri) {

            mImageRef.getBytes(ONE_MEGABYTE).addOnSuccessListener(new OnSuccessListener<byte[]>() {
                @Override
                public void onSuccess(byte[] bytes) {

                    Bitmap bm = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
                    DisplayMetrics dm = new DisplayMetrics();
                    getWindowManager().getDefaultDisplay().getMetrics(dm);

                    profilepic.setMinimumHeight(dm.heightPixels);
                    profilepic.setMinimumWidth(dm.widthPixels);
                    profilepic.setImageBitmap(bm);



                }
            }).addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception exception) {
                    // Handle any errors

                    Toast.makeText(Item.this, "Error with image" , Toast.LENGTH_LONG).show();

                }
            });

        }
    });
这些就是我的依赖关系

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-database:19.2.1'
implementation 'com.google.firebase:firebase-analytics:17.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.firebaseui:firebase-ui-auth:4.1.0'


implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'


implementation 'com.firebaseui:firebase-ui-database:4.3.2'


implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.squareup.picasso:picasso:2.5.2'

implementation 'id.zelory:compressor:2.1.0'

//noinspection GradleCompatible
implementation "com.android.support:support-compat:28.0.0"
implementation 'androidx.cardview:cardview:1.0.0'


implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'

因为您的firebase服务无法初始化..请尝试检查null。如果(mImageref!=null){您的逻辑}或尝试捕获firebasestore,因为您的firebase服务无法初始化..请尝试检查null。如果(mImageref!=null){您的逻辑}或尝试捕获firebasestore
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.0'
implementation 'com.google.firebase:firebase-database:19.2.1'
implementation 'com.google.firebase:firebase-analytics:17.4.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.firebaseui:firebase-ui-auth:4.1.0'


implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'


implementation 'com.firebaseui:firebase-ui-database:4.3.2'


implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.squareup.picasso:picasso:2.5.2'

implementation 'id.zelory:compressor:2.1.0'

//noinspection GradleCompatible
implementation "com.android.support:support-compat:28.0.0"
implementation 'androidx.cardview:cardview:1.0.0'


implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'