パブリック権限を持つ画像で ImageView を設定しようとしています。画像はブラウザから正しく読み込まれますが、アプリ内では機能しません:
Uri uri=Uri.parse("https://storage.googleapis.com/mybucket/filename.jpg");
ControllerListener controllerListener = new BaseControllerListener<ImageInfo>() {
@Override
public void onFinalImageSet(
String id,
@Nullable ImageInfo imageInfo,
@Nullable Animatable anim) {
if (imageInfo == null) {
return;
}
QualityInfo qualityInfo = imageInfo.getQualityInfo();
FLog.d("Final image received! " +
"Size %d x %d",
"Quality level %d, good enough: %s, full quality: %s",
imageInfo.getWidth(),
imageInfo.getHeight(),
qualityInfo.getQuality(),
qualityInfo.isOfGoodEnoughQuality(),
qualityInfo.isOfFullQuality());
}
@Override
public void onIntermediateImageSet(String id, @Nullable ImageInfo imageInfo) {
FLog.d(TAG,"Intermediate image received");
}
@Override
public void onFailure(String id, Throwable throwable) {
FLog.e(getClass(), throwable, "Error loading %s", id);
}
};
PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
.setControllerListener(controllerListener)
.setUri(uri);
// other setters
imageView.setController(controller.build());
例外はあまり明確ではありません。次のようになります。
java.lang.RuntimeException: Unsupported uri scheme! Uri is: https://storage.googleapis.co...
at com.facebook.imagepipeline.core.ProducerSequenceFactory.getBasicDecodedImageSequence(ProducerSequenceFactory.java:176)
at com.facebook.imagepipeline.core.ProducerSequenceFactory.getDecodedImageProducerSequence(ProducerSequenceFactory.java:129)
at com.facebook.imagepipeline.core.ImagePipeline.fetchDecodedImage(ImagePipeline.java:147)
at com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder.getDataSourceForRequest(PipelineDraweeControllerBuilder.java:82)
at com.facebook.drawee.backends.pipeline.PipelineDraweeControllerBuilder.getDataSourceForRequest(PipelineDraweeControllerBuilder.java:31)
at com.facebook.drawee.controller.AbstractDraweeControllerBuilder$2.get(AbstractDraweeControllerBuilder.java:320)
at com.facebook.drawee.controller.AbstractDraweeControllerBuilder$2.get(AbstractDraweeControllerBuilder.java:317)
at com.facebook.drawee.backends.pipeline.PipelineDraweeController.getDataSource(PipelineDraweeController.java:96)
at com.facebook.drawee.controller.AbstractDraweeController.submitRequest(AbstractDraweeController.java:392)
at com.facebook.drawee.controller.AbstractDraweeController.onAttach(AbstractDraweeController.java:332)
at com.facebook.drawee.view.DraweeHolder.attachController(DraweeHolder.java:276)
at com.facebook.drawee.view.DraweeHolder.setController(DraweeHolder.java:222)
at com.facebook.drawee.view.DraweeView.setController(DraweeView.java:87)
URL に何か他のものを追加する必要がありますか? 公開ファイルはそのままアクセスできるという印象を受けました。