Actualmente estoy usando Glide para cargar imagenes en mi app. Funciona bien hasta que tengo que cargar una imagen en un CustomInfoWindow. Me sale una advertencia que tiene que ver con el problema, ademas creo que tiene algo que ver con el cache disponible.
Advertencia:
Logcat:
W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
Otros Logcat:
W/DynamiteModule: Local module descriptor class for com.google.android.gms.googlecertificates not found.
I/DynamiteModule: Considering local module com.google.android.gms.googlecertificates:0 and remote module com.google.android.gms.googlecertificates:5
I/DynamiteModule: Selected remote version of com.google.android.gms.googlecertificates, version >= 5
W/zygote: Skipping duplicate class check due to unrecognized classloader
I/zygote: Do full code cache collection, code=508KB, data=376KB
I/zygote: After code cache collection, code=402KB, data=275KB
Import, build.gradle y clase donde llamo a Glide dentro de del infoWindow:
import android.Manifest
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.Point
import android.location.Location
import android.location.LocationManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.provider.MediaStore
import android.util.Log
import android.view.View
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.ImageView
import android.widget.Toast
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.core.view.GravityCompat
import androidx.core.view.isGone
import androidx.core.view.isVisible
import com.bumptech.glide.Glide
import com.bumptech.glide.annotation.GlideModule (Me aparece sin uso: Unused import directive )
import com.example.mappet001.reports.ReportPet
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import com.google.android.gms.maps.*
import com.google.android.gms.maps.model.*
import com.google.android.gms.tasks.OnCompleteListener
import com.google.firebase.Timestamp
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FieldValue
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.GeoPoint
import com.google.firebase.storage.FirebaseStorage
import kotlinx.android.synthetic.main.activity_maps.*
import kotlinx.android.synthetic.main.content_main.*
import kotlinx.android.synthetic.main.form_report.*
import kotlinx.android.synthetic.main.reportvisor_maps.*
import kotlinx.android.synthetic.main.reportvisor_maps.view.*
import java.io.ByteArrayOutputStream
import java.io.File
import java.text.SimpleDateFormat
import java.util.*
import kotlin.collections.ArrayList
import kotlin.math.cos
import kotlin.math.sin
Build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
buildToolsVersion "30.0.0"
defaultConfig {
applicationId "com.example.mappet001"
minSdkVersion 21
targetSdkVersion 30
versionCode 2
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.firebase:firebase-auth-ktx:19.3.2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.navigation:navigation-fragment:2.3.0'
implementation 'androidx.navigation:navigation-ui:2.3.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
implementation 'com.android.support:appcompat-v7'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
implementation 'com.google.firebase:firebase-firestore:21.5.0'
implementation 'com.google.firebase:firebase-storage-ktx:19.1.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.firebase:firebase-storage-ktx:19.1.1'
implementation 'com.google.firebase:firebase-database-ktx:19.3.1'
implementation 'com.google.firebase:firebase-messaging:20.2.3'
implementation 'com.firebaseui:firebase-ui-storage:6.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
}
inner class CustomInfoWindowGoogleMap(val context: Context) : GoogleMap.InfoWindowAdapter {
override fun getInfoContents(p0: Marker?): View? {
return null
}
@SuppressLint("InflateParams")
override fun getInfoWindow(p0: Marker?): View? {
val mInfoView = (context as Activity).layoutInflater.inflate(R.layout.reportvisor_maps, null)
val mInfoWindow: ReportPet? = p0?.tag as ReportPet?
mInfoView.title_window.text = mInfoWindow?.mTitleReport
mInfoView.date_ReportVisor.text = mInfoWindow?.mDate
mInfoView.description_ReportVisor.text = mInfoWindow?.mdescriptionReport
mInfoView.type_ReportVisor.text = mInfoWindow?.mTypeReport
try {
val imageReportVisor = mInfoView.findViewById<ImageView>(R.id.image_ReportVisor)
Glide.with(context).load(mInfoWindow?.mImageReport).into(imageReportVisor) // image
}catch (e: Exception){
Log.d("ERRORGLIDE","e: ${e.message}")
}
return mInfoView
}
}
Recalcar que no entra al catch().Si ejecuta las ordenes dentro del try. Si alguien fuera tan amable de explicarme como se implementa correctamente el modulo de Glide le estaría muy agradecido.
pd: Se que en github esta este link:GlideModule v4: Configuración pero no se por donde empezar.