dagger-2

    0热度

    1回答

    Android Studio中β2得到dagger2错误: 错误:执行失败的任务 ':武器:compileDebugJavaWithJavac'。 java.lang.NoClassDefFoundError: dagger/Provides 同样的错误: https://github.com/google/dagger/issues/843

    11热度

    1回答

    我使用Dagger2 Android的支持库Proguard的,但我不能编译我的项目,因为这个错误的: Warning:dagger.android.AndroidInjector: can't find referenced class com.google.errorprone.annotations.DoNotMock Warning:dagger.android.AndroidInjec

    0热度

    1回答

    我想实现以下行为: 使用由模块下单的范围有不同的范围提供了另一个模块的对象。 这是我的。我尝试了很多基于几个答案的更改,但我仍然无法解决此问题。 第一模块(应绑定到应用程序的生命周期) @Module public class AModule { private Context context; public AModule(Context context) { this.co

    2热度

    1回答

    我刚开始学习如何使用Dagger,并且我已将自己的Backend连接类转换为自动注入。 该类处理Retrofit并执行网络请求。它曾经有过的静态方法,但现在它是一个对象,例如: Backend.fetchPost(context, 42); // old way mBackend.fetchPost(42); // mBackend is an injected field 上下文用于检索提

    1热度

    1回答

    我重写Dagger 2组件以模拟Android中的依赖关系。为此,我使用自定义JUnit TestRunners。 它似乎在我的app/build.gradle我只能设置一个testRunner。 defaultConfig { applicationId 'com.xxx.xxx' minSdkVersion 18 targetSdkVersion 23

    0热度

    1回答

    我用匕首注入一个ViewModel成片段之前: class BaseFragment<T extends BaseViewModel> extends Fragment { @Inject T viewModel; @Override public void onAttach(Context context) { super.onAttach(cont

    1热度

    1回答

    我对Dagger 2相当陌生,而且我有以下类。 我有2个模块: DaoSessionModule @Module public class DaoSessionModule { private DaoSession daoSession; private Context context; public DaoSessionModule(Context conte

    2热度

    3回答

    我是kotlin和匕首的新手2.我尝试在Android Java中关注此guide。但错误是抛出... Error:Execution failed for task ':app:kaptDebugKotlin'. Internal compiler error. See log for more details 我做错了什么? 应用 class App : Application() {

    1热度

    2回答

    我有一个Dagger模块,它有两个构造不同Retrofit实例的@Provides方法。我也有两种方法需要使用Retrofit实例之一。 如何告诉Dagger我想在每个消费函数中使用Retrofit? 我的代码: @Provides @Singleton public OkHttpClient provideOkHttpClient(){ final OkHttpClient.Bui

    0热度

    1回答

    我从这个文档阅读https://google.github.io/dagger/api/latest/dagger/Component.html和SubComponents之间Component Dependencies差异,阅读这个线程太Dagger 2 subcomponents vs component dependencies 谁能帮我这行用一个例子手段。 子组件可以使用由它们的祖先组件和