Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 186008
Alex Hales
  • 0
Alex HalesTeacher
Asked: June 10, 20222022-06-10T14:14:10+00:00 2022-06-10T14:14:10+00:00

android – Cannot resolve symbol DaggerAppComponent

  • 0

[ad_1]

There is my GitHub project – https://github.com/alekseytimoshchenko/MVVM_FLOW that I haven’t used a lot of time and today I decided to check it out as a result I faced some compile/Gradle/build issues, so I needed to update some dependency and other things. Eventually looks like everything is ok, however, I got a compile

error: cannot find symbol
import com.example.krokosha.quizyourself.di.components.DaggerAppComponent;

This likely happens due to some specific dependencies or their version, I went through a few answers here on SO, but looks like everything is correct, but still, this class is not generated.

If it is suitable you are welcome to take a look on the project by the ref provided above, otherwise I’ll put some code here

There is my grale dependencies

...
    //Dependency Injection
    api "com.google.dagger:dagger:2.35.1"
    annotationProcessor "com.google.dagger:dagger-compiler:2.28.3"
    api "com.google.dagger:dagger-android:2.35.1"
    api "com.google.dagger:dagger-android-support:2.28.3" // if you use the support libraries
    annotationProcessor "com.google.dagger:dagger-android-processor:2.28.3"
...

and there is my class where I got an error:

package com.example.krokosha.quizyourself.di;

import android.content.Context;

import com.example.krokosha.quizyourself.di.components.AppComponent;
import com.example.krokosha.quizyourself.di.components.BaseComponent;
import com.example.krokosha.quizyourself.di.components.BaseComponentBuilder;
import com.example.krokosha.quizyourself.di.components.DaggerAppComponent;
import com.example.krokosha.quizyourself.di.moduls.AppModule;
import com.example.krokosha.quizyourself.di.moduls.BaseModule;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;
import javax.inject.Provider;

public class ComponentsHolder
{
    private final Context context;
    
    @Inject
    Map<Class<?>, Provider<BaseComponentBuilder>> builders;
    
    private Map<Class<?>, BaseComponent> components;
    private AppComponent appComponent;
    
    public ComponentsHolder(Context context)
    {
        this.context = context;
    }
    
    public ComponentsHolder init()
    {
        appComponent = DaggerAppComponent.builder().appModule(new AppModule(context)).build();
        appComponent.injectComponentsHolder(this);
        components = new HashMap<>();
        return this;
    }
    
    public BaseComponent getBaseComponent(Class<?> cls)
    {
        return getBaseComponent(cls, null);
    }
    
    public BaseComponent getBaseComponent(Class<?> cls, BaseModule module)
    {
        BaseComponent component = components.get(cls);
        
        if (component == null)
        {
            BaseComponentBuilder builder = builders.get(cls).get();
            
            if (module != null)
            {
                builder.module(module);
            }
            
            component = builder.build();
            components.put(cls, component);
        }
        
        return component;
    }
    
    public void releaseBaseComponent(Class<?> cls)
    {
        components.put(cls, null);
    }
}

What is a possible problem here?

[ad_2]

  • 0 0 Answers
  • 7 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 325 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 295 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 291 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.