Giter Site home page Giter Site logo

codelab-android-dagger-to-hilt's People

Contributors

osuleymanova avatar yenerm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codelab-android-dagger-to-hilt's Issues

Please clarify the Documentation

The Documentation on https://codelabs.developers.google.com/codelabs/android-dagger-to-hilt/ is confusing. It is not clear when the application should build and what the error messages mean. Even I used Dagger before in a Project I have no understanding what I'm doing within this tutorial.

I'ts more like a do ist this way tutorial for that example. But gives you no real understanding about what you are doing.

Please clarify:

  • At what points the tutorial should build
  • What error messages occur within the migration and what they mean
  • Give a valid starting point
  • Explain more the coexistence of dagger and hilt while migrating

Branch Master is not the starting point

Hello there,

According to page #2 of the codelab, we are supposed to add Hilt to the project ourselves. However, as seen in the following lines, Hilt is already included in this project in Master.
https://github.com/googlecodelabs/android-dagger-to-hilt/blob/267db264888e8c76b9c6b54f663d9462fbb55e37/build.gradle#L5
https://github.com/googlecodelabs/android-dagger-to-hilt/blob/267db264888e8c76b9c6b54f663d9462fbb55e37/build.gradle#L13
https://github.com/googlecodelabs/android-dagger-to-hilt/blob/267db264888e8c76b9c6b54f663d9462fbb55e37/app/build.gradle#L9
https://github.com/googlecodelabs/android-dagger-to-hilt/blob/267db264888e8c76b9c6b54f663d9462fbb55e37/app/build.gradle#L71-L73

Moreover, this also prevent us from running the project at its starting point, because Hilt produces the following issue:

com\example\android\dagger\di\AppSubcomponents.java:7: error: [Hilt]
public final class AppSubcomponents {
             ^
  com.example.android.dagger.di.AppSubcomponents must also be annotated with @InstallIn.
  [Hilt] Processing did not complete. See error above for details

Instructions ask to call non-existent methods

At step 8. Migrating another scoped component, the instructions refer to call initData() on the UserDataRepository yet the method does not exist nor is there any obvious alternative code that's analogous to it.

Error on Building sample app (As soon as it's imported into Android Studio)

android-dagger-to-hilt/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/AppSubcomponents.java:7: error: [Hilt]
public final class AppSubcomponents {
^
com.example.android.dagger.di.AppSubcomponents must also be annotated with @Installin.
[Hilt] Processing did not complete. See error above for details.
e: /home/ny/AndroidStudioProjects/DaggerHilt/android-dagger-to-hilt/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/StorageModule.java:7: error: [Hilt]
public abstract class StorageModule {
^
com.example.android.dagger.di.StorageModule must also be annotated with @Installin.
[Hilt] Processing did not complete. See error above for details.
w: warning: The following options were not recognized by any processor: '[dagger.hilt.android.internal.disableAndroidSuperclassValidation, kapt.kotlin.generated]'

e: /home/ny/AndroidStudioProjects/DaggerHilt/android-dagger-to-hilt/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/AppSubcomponents.java:7: error: [Hilt]
public final class AppSubcomponents {
^
com.example.android.dagger.di.AppSubcomponents must also be annotated with @Installin.
�[1;31m[Hilt] Processing did not complete. See error above for details.�[0m

e: /home/ny/AndroidStudioProjects/DaggerHilt/android-dagger-to-hilt/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/StorageModule.java:7: error: [Hilt]
public abstract class StorageModule {
^
com.example.android.dagger.di.StorageModule must also be annotated with @Installin.
�[1;31m[Hilt] Processing did not complete. See error above for details.�[0m

w: warning: The following options were not recognized by any processor: '[dagger.hilt.android.internal.disableAndroidSuperclassValidation, kapt.kotlin.generated]'

The error goes away when I remove all references to hilt in the module's build,gradle.

Using library gradle module DependencyComponent as a dependency for Hilt ApplicationComponent

Hello, I tried finding a solution to connect the existing library DependencyComponent to Hilt ApplicationComponent. It looks like it is impossible at the moment.
Could you please clarify that.

Example:
we have the following gradle modules structure:

  • utils (library)
  • common (library)
  • feature1 (library, depends on common and utils)
  • feature2 (library, depends on utils)
  • app (application, assembles all modules above)
// from feature1 lib module
interface Feature1DependencyComponent {
  val feature1Api: Feature1Api
}

// from app module
@Component(
  dependencies = [Feature1DependencyComponent::class],
  modules = [AppModule1::class, AppModule2::class]
)
@Singleton
interface ApplicationComponent {
  val feature1Api: Feature1Api // to have explicit exposing
}

As you can see @Module can't be used in feature1 because it doesn't know anything about ApplicationComponent to use with @InstallIn.

Question: how to connect Feature1DependencyComponent without using @BindsInstance to Hilt ApplicationComponent?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.