AndroidMultiModule和Hilt问题
创始人
2024-10-09 09:01:40
0
  1. 在主应用程序模块中,将您的AppModule中的provideContext方法更改为以下内容:

@Singleton @Provides fun provideContext(@ApplicationContext context: Context): Context { return context }

  1. 在每个模块的build.gradle文件中,添加以下依赖项:

implementation "com.google.dagger:hilt-android:2.28-alpha" kapt "com.google.dagger:hilt-compiler:2.28-alpha"

  1. 在每个模块的Application类上添加@HiltAndroidApp注释。

@HiltAndroidApp class MyApplication : Application()

  1. 对于每个模块,必须在其build.gradle文件中添加以下Hilt插件:

plugins { id 'com.android.library' id 'kotlin-android' // Add this line id 'dagger.hilt.android.plugin' }

  1. 最后,在每个模块的build.gradle文件中,添加以下Hilt依赖项:

dependencies { implementation "com.google.dagger:hilt-android:2.28-alpha" kapt "com.google.dagger:hilt-compiler:2.28-alpha"

// Add this line
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0-alpha03"

}

这些步骤应该帮助您解决Android Multi Module和Hilt的问题。

相关内容

热门资讯

透视透视!wepoker可以免... 透视透视!wepoker可以免费玩吗(透视)微信小程序开心泉州辅助器(总是是真的辅助app)-哔哩哔...
这一现象值得深思!hhpoke... 这一现象值得深思!hhpoker的辅助是真的吗(透视)新上游通用挂(一直存在有辅助安装)-哔哩哔哩1...
透视透视挂!德普之星透视免费(... 透视透视挂!德普之星透视免费(透视)腾讯欢乐卡五星辅助器(好像有辅助神器)-哔哩哔哩所有人都在同一条...
据监测!德州局脚本(透视)微信... 据监测!德州局脚本(透视)微信小程序嘟嘟十三张脚本(切实真的有辅助辅助器)-哔哩哔哩1、超多福利:超...
事发当天!红龙poker作必弊... 事发当天!红龙poker作必弊指令(透视)微乐自建房怎么提高胜率(一直是真的辅助插件)-哔哩哔哩1、...
透视好友!sohoo poke... 透视好友!sohoo poker辅助器(透视)阿当比鸡有透视吗(确实真的是有辅助下载)-哔哩哔哩1、...
今天上午!pokernow辅助... 今天上午!pokernow辅助工具(透视)小唐家乐园辅助(本来是真的辅助app)-哔哩哔哩1、完成小...
透视脚本!wepoker辅助透... 透视脚本!wepoker辅助透视(透视)四川熊猫辅助软件(一直存在有辅助安装)-哔哩哔哩1、许多玩家...
据报道!wpk安卓下载辅助(透... 据报道!wpk安卓下载辅助(透视)酷玩联盟破解版下载(一直真的有辅助下载)-哔哩哔哩1、酷玩联盟破解...
透视真的!约局吧德州透视(透视... 透视真的!约局吧德州透视(透视)微信小程序财神十三张辅助(其实真的有辅助安装)-哔哩哔哩1、不需要A...