gpt4 book ai didi

android - 错误 : cannot find symbol class DaggerAppComponent version conflict with other dependencies

转载 作者:行者123 更新时间:2023-11-30 04:56:48 25 4
gpt4 key购买 nike

我在构建 android 项目时收到“错误:找不到符号类 DaggerAppComponent”,我将 Dagger 和其他依赖项的版本更改为最新版本,我也厌倦了旧版本但仍然出现同样的错误。

我的build.gradle文件

 // ButterKnife libraries
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'

// Dagger 2 libraries


implementation "com.google.dagger:dagger:2.11"
annotationProcessor "com.google.dagger:dagger-compiler:2.11"

// Components for Android
implementation group: 'com.google.android.material', name: 'material', version: '1.2.0-alpha01'

// Networking
implementation 'com.squareup.retrofit2:retrofit:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.6.2'

// gogole support design
implementation 'com.android.support:design:29.0.0'

// Lombok for pojo
implementation 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'

//Rx java and Rx android
implementation 'io.reactivex:rxjava:1.3.1'
implementation 'io.reactivex:rxandroid:1.1.0'

//Realm local DB
implementation 'io.realm:android-adapters:1.2.0'

//SmileyRating Bar
implementation 'com.github.sujithkanna:smileyrating:1.6.8'

最佳答案

这里我收到错误找不到符号类 DaggerAppComponent

 public class Injector {

// Singleton instance
private static Injector instance;

// components
private AppComponent appComponent;

// Private constructor to make it singleton
private Injector() {
}

/**
* Get the singleton Injector instance
*
* @return Injector
*/
private static Injector instance() {
if (instance == null) {
instance = new Injector();
}
return instance;
}

/**
* Creates application component which is used of injection later.
*
* @param application
*/
public static void createApplicationComponent(Application application) {
if (instance().appComponent == null) {
instance().appComponent = DaggerAppComponent.builder()
.appModule(new AppModule(application))
.build();
}
}

/**
* Returns the component for injection.
*
* @return
*/
public static AppComponent component() {
return instance().appComponent;
}
}

关于android - 错误 : cannot find symbol class DaggerAppComponent version conflict with other dependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58973773/

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