GlideApp cannot be found - java

error: cannot find symbol variable GlideApp
This is the error I have been getting.
I'm using Android studio 3.3.1 and imported these modules for glide.
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
GlideApp.with(this /* context */)
.load(storageReference)
.into(MainImage);

If GlideAPP can't be generated
annotationProcessor com.github.bumptech.glide:compiler:4.9.0
Must be with ‘AppGlideModule Implementation class’ In the same module

To use generated API in Glide you need to create a class and extend AppGlideModule and use #GlideModule annotation, for example:
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
#GlideModule
public final class MyAppGlideModule extends AppGlideModule {
}
After this rebuild and you should be able to use GlideApp for more information visit:
http://bumptech.github.io/glide/doc/generatedapi.html

def glide_version = "4.12.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
Then Sync it will work.
Working Screenshot
Optional: You can also do this. Build -> Make Module

If you use Kotlin, try to use kapt instead of annotationProcessor.
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"

Related

Hilt :- Not able to use the #AndroidEntryPoint in the AppCompatActivity getting DefaultV iewModelFactories exceptions?

I want to use the Hilt in my project for getting the helper class object as the common for my activity. I have tried the below lines of code for it
Manifest file entry
<application
android:name=".application.AppController"
android:allowBackup="false"
My AppController class
#HiltAndroidApp
public class AppController extends Application implements Configuration.Provider {
}
Please check my gradles file for it
implementation "androidx.activity:activity-ktx:1.2.3"
implementation 'androidx.fragment:fragment-ktx:1.3.4'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
implementation 'com.google.dagger:hilt-android:2.36'
kapt 'androidx.hilt:hilt-compiler:1.0.0'
kapt 'com.google.dagger:hilt-android-compiler:2.31.2-alpha'
Please check my classPath entry below
classpath "com.google.dagger:hilt-android-gradle-plugin:2.36"
Now please check my NVModule Module class in which i have used the Hilt
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
#Module
#InstallIn(SingletonComponent::class)
class NVModule {
#Provides
fun provideDeviceDiagnosticHelper(): DeviceDiagnosticHelper{
return DeviceDiagnosticHelper()
}
}
Now please check the Activity class in which i have injected the Hilt object
#AndroidEntryPoint
public class AutomaticTestActivity extends AppCompatActivity {
private AutomaticTestPresenter automaticTestPresenter;
private AutomaticTestView automaticTestView;
ActivityDeviceDiagnosticBinding mBinding;
#Inject
DeviceDiagnosticHelper deviceDiagnosticHelper;
}
But I am getting the following exception while Running the app please check it once
Exception:-
/home/..../com/my/app/activity/Hilt_AutomaticTestActivity.java:70: error: method getActivityFactory in class DefaultViewModelFactories cannot be applied to given types;
return DefaultViewModelFactories.getActivityFactory(this);
^
required: ComponentActivity,Factory
found: Hilt_AutomaticTestActivity
reason: actual and formal argument lists differ in length
Please help me to short of from this problem
Seems to be version mismatch. Use following versions:
// hilt
implementation 'com.google.dagger:hilt-android:2.36'
kapt 'com.google.dagger:hilt-android-compiler:2.36'
kaptAndroidTest 'com.google.dagger:hilt-android-compiler:2.36'
kaptTest 'com.google.dagger:hilt-android-compiler:2.36'
// implementation "androidx.hilt:hilt-navigation:1.0.0"
// implementation "androidx.hilt:hilt-navigation-fragment:1.0.0"
kapt 'androidx.hilt:hilt-compiler:1.0.0'
And
apply plugin: 'dagger.hilt.android.plugin'
And
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.36'
version of dependency for project level and app level must be same.
like :
classpath "com.google.dagger:hilt-android-gradle-plugin:2.38.1"
and
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-android-compiler:2.38.1"
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-android-compiler:2.38.1"
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
kapt 'androidx.hilt:hilt-compiler:1.0.0'
worked for me

I have a Error to add #Entity data annotation to class android for room database

My friends from the Android site I copied the dependencies related to room in Gradle but I can not add Dataantotaion related to Entity to the class and after add #Entity it has Error "Canot resolve symbol 'Entity'
I use Java android
Change
annotationProcessor "android.arch.persistence.room:compiler:$Versionroom"
To
implementation "android.arch.persistence.room:compiler:$Versionroom"
And add
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath = true
}
}
hope this help you fix the symbol resolving problem.
you have to add room dependencies and annotationProcessor dependencies for it Try is :
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"

Unable to add dependency: Failed to resolve: androidx.lifecycle:lifecycle-extensions:2.2.0-rc2

I am trying to add few dependencies to my Android project but I'm still getting some weird errors.
I am trying to add recommended dependencies which I've found on CodeLabs but it steel does not allow me to sync my gradle files successfully.
The error that is keep showing up is the following: ERROR: Failed to resolve: androidx.lifecycle:lifecycle-extensions:2.2.0-rc2
Code: inside gradle module
// Room components
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"
androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion"
// UI
implementation "com.google.android.material:material:$rootProject.materialVersion"
// Testing
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
Text inside gradle project:
ext {
roomVersion = '2.2.1'
archLifecycleVersion = '2.2.0-rc2'
coreTestingVersion = '2.1.0'
materialVersion = '1.0.0'
}
This is also one error that I am getting sometimes, it appears randomly...
ERROR: Manifest merger failed : Attribute application#appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.1.0] AndroidManifest.xml:24:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:11:5-28:19 to override.
The error log literally says there is no androidx.lifecycle:lifecycle-extensions version 2.2.0-rc2.
Change archLifecycleVersion = '2.2.0-rc2' to archLifecycleVersion = '2.2.0-rc02' to fix that error.
The APIs in lifecycle-extensions have been deprecated. Instead, add dependencies for the specific Lifecycle artifacts you need.
dependencies {
def lifecycle_version = "2.2.0"
def arch_version = "2.1.0"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// Annotation processor
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
// optional - helpers for implementing LifecycleOwner in a Service
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
// optional - ReactiveStreams support for LiveData
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$arch_version"
}
From this source

android build error: can't find symbol class IntDef

Using Android Studio to build the android version of a react native app. I just received
'error: cannot find symbol class IntDef'
It's used in the following code:
#IntDef(flag = true, value = { Information.BATTERY, Information.RSSI, Information.API_VERSION, Information.LED,
Information.APPLICATION_VERSION })
the bottom of my dependencies block looks like this:
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
Do I need to make an import at the top of this file..or is do I need to add to the build.gradle such as implementation 'androidx.appcompat:appcompat:1.0.0'
inside the dependencies block?
I had the same issues except it was with ArrayMap, this was fixed by adding
compile "com.android.support:support-core-utils:24.2.0"
in the dependencies
You probably will have to include the following in your build.gradle file:
dependencies {
implementation 'com.android.support:support-annotations:28.0.0'
}
And the import statement in your class would be such :
import android.support.annotation.IntDef;

Can't import "import com.google.firebase.firestore.MetadataChanges"

I have a question about the FirestoreRecyclerOptions :
The FirestoreRecyclerOptions cannot import
com.google.firebase.firestore.MetadataChanges
When I compile my program I have the following error
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/firestore/MetadataChanges
I think it's a version problem in the gradle. Do you know how to fix this?
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.firebaseui:firebase-ui-auth:4.3.0'
//Firestore
implementation 'com.google.firebase:firebase-firestore:18.0.1'
// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:4.3.1'
implementation 'com.google.firebase:firebase-functions:16.1.3'
implementation 'com.firebaseui:firebase-ui-storage:4.3.1'
The function when i call the recycleroption
private FirestoreRecyclerOptions<chat> generateOptionsForAdapter(Query query){
return new FirestoreRecyclerOptions.Builder<chat>()
.setQuery(query,chat.class)
.setLifecycleOwner(this)
.build();
}

Categories

Resources