我正在使用以下库使用图像URL从Firebase数据库中提取应用中的图像和文本。我的应用程序显示带有图像和文本的滑行视图,但是图像全部为灰色/白色。有谁知道可能是什么问题?
我能够将图像上传到Firebase,但是在下载图像时,logcat显示在下面
W/Glide: Load failed for com.google.android.gms.tasks.XXXXXXX with size [1050x600]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 3 causes:
java.io.FileNotFoundException(/com.google.android.gms.tasks.XXXXXX (No such file or directory))
java.io.FileNotFoundException(No such file or directory)
java.io.FileNotFoundException(No such file or directory)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 3): class com.bumptech.glide.load.engine.GlideException:
Fetching data failed, class java.io.InputStream, LOCAL
There was 1 cause:
java.io.FileNotFoundException(/com.google.android.gms.tasks.XXXXXX (No such file or directory))
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException:
Fetch failed`
这很成功
android {
compileSdkVersion 26
//buildToolsVersion "26.0.3"
defaultConfig {
applicationId "com.checkbox"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
repositories {
mavenCentral()
google()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//implementation 'com.android.support:appcompat-v7:26.3.1'
implementation 'com.android.support:appcompat-v7:26.0.0-beta2'
implementation 'com.android.support:design:26.0.0-beta2'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//implementation 'com.google.firebase:firebase-auth:10.2.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
//implementation 'com.android.support:support-v4:26.3.1'
implementation 'com.android.support:support-v4:26.0.0-beta2'
implementation 'de.hdodenhof:circleimageview:2.1.0'
//implementation 'com.google.firebase:firebase-database:10.2.0'
implementation 'com.google.firebase:firebase-database:16.0.6'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
//implementation 'com.google.firebase:firebase-storage:10.2.0'
implementation 'com.google.firebase:firebase-storage:16.0.5'
//implementation 'com.firebaseui:firebase-ui-database:2.0.0'
implementation 'com.firebaseui:firebase-ui-storage:3.2.1'
implementation 'id.zelory:compressor:2.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
//implementation 'com.google.firebase:firebase-messaging:10.2.0'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.android.support:recyclerview-v7:26.0.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.firebase:firebase-client-android:2.4.0'
implementation 'com.android.support:cardview-v7:26.0.0'
implementation('com.github.bumptech.glide:glide:3.8.0') {
exclude group: "com.android.support"
}
}
apply plugin: 'com.google.gms.google-services'
}
public class RecyclerViewAdapter extends RecyclerView.Adapter {
Context context;
List<ImageUploadInfo> MainImageUploadInfoList;
public RecyclerViewAdapter(Context context, List<ImageUploadInfo> TempList) {
this.MainImageUploadInfoList = TempList;
this.context = context;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.content_recycler_view_adapter, parent, false);
ViewHolder viewHolder = new ViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
ImageUploadInfo UploadInfo = MainImageUploadInfoList.get(position);
holder.imageNameTextView.setText(UploadInfo.getImageName());
//Loading image from Glide library.
Glide.with(context).load(UploadInfo.getImageURL()).into(holder.imageView);
}
@Override
public int getItemCount() {
return MainImageUploadInfoList.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public TextView imageNameTextView;
public ViewHolder(View itemView) {
super(itemView);
imageView = (ImageView) itemView.findViewById(R.id.imageView);
imageNameTextView = (TextView) itemView.findViewById(R.id.ImageNameTextView);
}
}