我想在 android 库中尝试 Hilt DI。
它依赖于另一个项目,有自己的子模块。我遇到的第一个问题是需要Application用@HiltAndroidApp. 现在我的Application库 ofc 中没有任何扩展,但想利用 Hilt 及其预定义组件。
在这种情况下,有可能还是应该只使用 Dagger?我找到了 Dagger 的解决方案,其中库依赖注入是完全独立的(客户端不知道库的 DI):Dagger 解决方案,很想听听对此的任何意见,也许有人已经为这个问题付出了很大的努力并且可以分享他的见解。
今天使用roboelectric和junit启动测试类时会遇到这样的问题:
Information:Gradle: Executing tasks: [:app:assembleDebug, :app:assembleDebugUnitTest]
Error:Gradle: failed to create directory 'E:\AndroidKotlin\FooApp\app\build\generated\source\r\debug\com\example\foo\fooapp'
Error:Gradle: java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Gradle: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:
Error:Gradle: Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Run Code Online (Sandbox Code Playgroud)
也许有人早点遇到过这样讨厌的事情,能帮助我这么好;)?如果您不知道,请告诉我如何自己尝试找到它.我已经做了清洁项目并重建:)
好的,我知道我可以在那里找到所有 androidx 库:AndroidX 库,但请有人解释我如何弄清楚如何在我的依赖项中正确命名它们(使用 Gradle 作为构建系统的 Android 项目)。我真的很感激一些通用的方案,如前例。支持库,它们曾经包含依赖项的 gradle 配置,现在这些都没有了,所以我怀疑我遗漏了一些非常简单的东西,这些东西应该适用于提供的链接中列出的所有库。
我尝试使用调色板发布:
implementation 'androidx.palette.graphics:1.0.0'
Run Code Online (Sandbox Code Playgroud)
结果ERROR: Failed to resolve: androidx.palette.graphics:1.0.0:
提前致谢。