Kotlin中的“宁愿在该类上运行匕首处理器”
每当我对kotlin类进行注入时,我都会在构建中得到此注释(顺便说一句,我有一个既包含kotlin又包含Java的混合android项目)。 例如,执行以下gradle任务:(compileStagingDebugJavaWithJavacStagingDebug是我的构建变体),我收到以下消息: “注意:为com.packageNameXXX.CourseDiscoveryMapFragment生成MemberInjector或Factory。最好在该类上运行匕首处理器。” 我的CourseDiscoveryMapFragment代码可以在这里看到: class CourseDiscoveryMapFragment : Fragment(){ @Inject lateinit var presenter: CourseDiscoveryMapPresenter lateinit var mapView: MapView override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { val view = inflater.inflate(R.layout.fragment_discovery_map, container, false) MapsInitializer.initialize(activity) mapView = view.mapView mapView.onCreate(savedInstanceState?.getBundle(BUNDLE_KEY_MAP_STATE)) (activity as BaseActivity) .activityComponent.inject(this) } 我的ActivityComponent是: @ActivityScope @Subcomponent(modules = ActivityModule.class) public interface …