我正在使用Firebase开发Android Studio。我创建了一些用户,可以在其中输入名称和个人资料图片,如下所示
UserProfileChangeRequest userProfileChangeRequest = new
UserProfileChangeRequest.Builder()
.setDisplayName(uName)
.setPhotoUri(uri)
.build();
user.updateProfile(userProfileChangeRequest).addOnCompleteListener(new
OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if(!task.isSuccessful()){
String t = task.getException().getMessage();
showMessage(t);
}else {
showMessage("Profile Created");
}
}
});
当我调用user.getPhotoUrl()时,就会出现问题,它会向我返回安全异常。我也尝试过使用Glide库加载图像,但仍然出错。 以下是错误线程
2019-03-15 17:15:41.728 6617-6617/com.mmcorp.maaz.notes W/Glide: Load failed for content://com.google.android.apps.photos.contentprovider/-1/1/content%3A%2F%2Fmedia%2Fexternal%2Fimages%2Fmedia%2F140/ORIGINAL/NONE/632722170 with size [475x494]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There was 1 cause:
java.lang.SecurityException(Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{69d63c 6617:com.mmcorp.maaz.notes/u0a101} (pid=6617, uid=10101) that is not exported from UID 10079)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{69d63c 6617:com.mmcorp.maaz.notes/u0a101} (pid=6617, uid=10101) that is not exported from UID 10079
2019-03-15 17:15:41.731 6617-6617/com.mmcorp.maaz.notes I/Glide: Root cause (1 of 1)
java.lang.SecurityException: Permission Denial: opening provider com.google.android.apps.photos.contentprovider.impl.MediaContentProvider from ProcessRecord{69d63c 6617:com.mmcorp.maaz.notes/u0a101} (pid=6617, uid=10101) that is not exported from UID 10079
at android.os.Parcel.createException(Parcel.java:1942)
at android.os.Parcel.readException(Parcel.java:1910)
at android.os.Parcel.readException(Parcel.java:1860)
at android.app.IActivityManager$Stub$Proxy.getContentProvider(IActivityManager.java:4181)
at android.app.ActivityThread.acquireProvider(ActivityThread.java:5970)
at android.app.ContextImpl$ApplicationContentResolver.acquireUnstableProvider(ContextImpl.java:2592)
at android.content.ContentResolver.acquireUnstableProvider(ContentResolver.java:1828)
at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1442)
at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1295)
at android.content.ContentResolver.openInputStream(ContentResolver.java:1015)
at com.bumptech.glide.load.data.StreamLocalUriFetcher.loadResourceFromUri(StreamLocalUriFetcher.java:85)
at com.bumptech.glide.load.data.StreamLocalUriFetcher.loadResource(StreamLocalUriFetcher.java:60)
at com.bumptech.glide.load.data.StreamLocalUriFetcher.loadResource(StreamLocalUriFetcher.java:15)
at com.bumptech.glide.load.data.LocalUriFetcher.loadData(LocalUriFetcher.java:44)
at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:62)
at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:302)
at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:272)
at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:233)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.am.ActivityManagerService.getContentProviderImpl(ActivityManagerService.java:12188)
at com.android.server.am.ActivityManagerService.getContentProvider(ActivityManagerService.java:12585)
at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:357)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3291)
at android.os.Binder.execTransact(Binder.java:731)
2019-03-15 17:15:41.751 6617-6710/com.mmcorp.maaz.notes D/FA: Connected to remote service
2019-03-15 17:15:41.762 6617-6710/com.mmcorp.maaz.notes V/FA: Processing queued up service tasks: 3
2019-03-15 17:15:42.034 6617-6628/com.mmcorp.maaz.notes I/corp.maaz.note: Background concurrent copying GC freed 8013(904KB) AllocSpace objects, 10(392KB) LOS objects, 49% free, 2MB/4MB, paused 9.146ms total 294.279ms
2019-03-15 17:15:47.073 6617-6710/com.mmcorp.maaz.notes V/FA: Inactivity, disconnecting from the service