本文介绍了Dagger 2应用程序使用使用Dagger 1的库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我发现自己处于将应用程序从使用Dagger 1转换为Dagger 2的情况.但是,此应用程序使用的是使用Dagger 1的库,并且在我的应用程序启动期间遇到以下异常

I am finding myself in situation where I am transitioning application from using Dagger 1 to Dagger 2. However this application uses a library that is using Dagger 1 and during my application startup I get following exception

    E/AndroidRuntime: FATAL EXCEPTION: main
     java.lang.NoClassDefFoundError: Failed resolution of: Ldagger/ObjectGraph;
 Caused by: java.lang.ClassNotFoundException: Didn't find class "dagger.ObjectGraph" on path: DexPathList[

我确实有progard文件,但是保留了所有Dagger前缀.所以问题是,我需要将该库转换为dagger2还是应该将这两种内容共存?

I do have progard file but that keeps everything Dagger prefix. So question is, do I need to convert this library to dagger2 or those two things should co-exists?

推荐答案

您应该能够同时拥有Dagger1和Dagger2的应用程序.但是,您将需要在gradle中将它们都添加为依赖项.

You should be able to have an application with both Dagger1 and Dagger2. You will however need to add both as dependencies in gradle.

这篇关于Dagger 2应用程序使用使用Dagger 1的库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 19:43