gpt4 book ai didi

kotlin - 从 Firebase 存储中获取图像。 GlideApp Unresolved reference

转载 作者:行者123 更新时间:2023-12-02 13:22:32 30 4
gpt4 key购买 nike

我已经尝试了网络上的所有解决方案来尝试解决GlideApp没有成功。我可以使用另一种方法从 Firebase 存储中检索图像并放入 ImageView而不是 Glide ?我担心如果最初很难找到使用 Glide 的解决方案,那么接下来会发生什么?谷歌推荐它,但我就是无法让它工作。这是我正在实现的:

implementation "com.github.bumptech.glide:glide:4.3.1"
Implementation "com.github.bumptech.glide:okhttp3-integration:4.3.1"
kapt "com.github.bumptech.glide:compiler:4.3.1"1

这是我的片段代码:
val storageRef = data.getReference()
val pathReference = storageRef.child(user?.uid.toString() + "/images/coverphoto")
GlideApp.with(context)
.load(pathReference)
.into();

最初使用 Glide 真的不应该这么难。

我应该提到这是一个 kotlin 项目,我正在尝试访问片段中的图像。

以防万一您需要它:
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'org.jetbrains.anko:anko-common:0.9'
implementation 'com.beust:klaxon:3.0.1'
implementation "com.android.support:recyclerview-v7:27.1.1"
testImplementation 'junit:junit:4.12'
implementation "com.github.bumptech.glide:glide:4.3.1"
implementation "com.github.bumptech.glide:okhttp3-integration:4.3.1"
kapt "com.github.bumptech.glide:compiler:4.3.1"
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'

****第二次更新****

这是我的完整 gradle.build 文件:
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.ntx_deisgns.cyberchatter.cyberchatter"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
customDebugType {
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}

repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
// implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'org.jetbrains.anko:anko-common:0.9'
implementation 'com.beust:klaxon:3.0.1'
implementation "com.android.support:recyclerview-v7:27.1.1"
testImplementation 'junit:junit:4.12'
implementation 'com.github.bumptech.glide:annotations:4.7.1'
kapt 'com.github.bumptech.glide:compiler:4.7.1'
implementation "com.github.bumptech.glide:okhttp3-integration:4.6.1"
implementation 'com.github.bumptech.glide:annotations:4.7.1'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

最佳答案

在您的 app 中的任意位置添加此类模块,它会工作:

import com.bumptech.glide.annotation.GlideModule
import com.bumptech.glide.module.AppGlideModule

@GlideModule
class RequiredAppGlideModule : AppGlideModule()

并且不要忘记 glide 编译器:
implementation 'com.github.bumptech.glide:annotations:4.7.1'
kapt 'com.github.bumptech.glide:compiler:4.7.1'
implementation "com.github.bumptech.glide:okhttp3-integration:4.6.1"
implementation 'com.github.bumptech.glide:annotations:4.7.1'

并确保你也这样做
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'

关于kotlin - 从 Firebase 存储中获取图像。 GlideApp Unresolved reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52140973/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com