android / codelab-android-dagger

Apache License 2.0
183 stars 157 forks source link

Step 8 android.os.UserManager cannot be provided without an @Inject constructor #39

Open LazarRistic opened 4 years ago

LazarRistic commented 4 years ago

Step 8 -> Using Dagger in the Main Flow -> 2. Error when building: e: /Users/lazarristic/PersonalWorkspace/Android/Learning/Dagger/android-dagger/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/AppComponent.java:7: error: [Dagger/MissingBinding] android.os.UserManager cannot be provided without an @Inject constructor or an @Provides-annotated method. public abstract interface AppComponent { ^ android.os.UserManager is injected at com.example.android.dagger.main.MainActivity.userManager com.example.android.dagger.main.MainActivity is injected at com.example.android.dagger.di.AppComponent.inject(com.example.android.dagger.main.MainActivity)

Android Studio has imported android.os.UserManager instead of com.example.android.dagger.user.UserManager

Please add imports in code.

tzrgaga commented 4 years ago

Step 8 -> Using Dagger in the Main Flow -> 2. Error when building: e: /Users/lazarristic/PersonalWorkspace/Android/Learning/Dagger/android-dagger/app/build/tmp/kapt3/stubs/debug/com/example/android/dagger/di/AppComponent.java:7: error: [Dagger/MissingBinding] android.os.UserManager cannot be provided without an @Inject constructor or an @Provides-annotated method. public abstract interface AppComponent { ^ android.os.UserManager is injected at com.example.android.dagger.main.MainActivity.userManager com.example.android.dagger.main.MainActivity is injected at com.example.android.dagger.di.AppComponent.inject(com.example.android.dagger.main.MainActivity)

Android Studio has imported android.os.UserManager instead of com.example.android.dagger.user.UserManager

Please add imports in code.

You just need remove that line,then re-import,done!