dagger test component not being generated when the project contains multiple android modulesCannot open layout in Android StudioDagger not generating components for /test classGoogle mobile vision library 11.8.0 is not recognizedHow to display Map on emulatorKotlin fails to compile a libraryAndroid Studio Tabs and ViewPager RenderingAndroid Studio 3.2.1 - New project fails to rundebug-apk work fine but sign apk release crash on main acitvityonActivityResult() is not working in fragment “ OUTPUT: You haven't picked Image ”Could not find class 'dalvik.system…'
Why are GND pads often only connected by four traces?
Unicode Character/Symbol in Lua(La)TeX
Value of a binomial series
Can I summon an otherworldly creature with the Gate spell without knowing its true name?
How to attach cable mounting points to a bicycle frame?
Can a person survive on blood in place of water?
role of -られ, -し, and construction of the phrase
Make 24 using exactly three 3s
Compaq Portable vs IBM 5155 Portable PC
Is Jon Snow the last of his House?
Why most published works in medical imaging try reducing false positives?
Why does Mjolnir fall down in Age of Ultron but not in Endgame?
My employer faked my resume to acquire projects
Alternatives to achieve certain output format
How to patch glass cuts in a bicycle tire?
When the Torah was almost lost and one (or several) Rabbis saved it?
Remove CiviCRM and Drupal links / banner on profile form
I know that there is a preselected candidate for a position to be filled at my department. What should I do?
Construct a word ladder
Should one buy new hardware after a system compromise?
Specific alignment within beginalign environment
Efficient Algorithm for the boundary of a set of tiles
What is the function of the corrugations on a section of the Space Shuttle's external tank?
Why didn't Thanos use the Time Stone to stop the Avengers' plan?
dagger test component not being generated when the project contains multiple android modules
Cannot open layout in Android StudioDagger not generating components for /test classGoogle mobile vision library 11.8.0 is not recognizedHow to display Map on emulatorKotlin fails to compile a libraryAndroid Studio Tabs and ViewPager RenderingAndroid Studio 3.2.1 - New project fails to rundebug-apk work fine but sign apk release crash on main acitvityonActivityResult() is not working in fragment “ OUTPUT: You haven't picked Image ”Could not find class 'dalvik.system…'
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Android Studio 3.4
kotlin 1.3.0
dagger 2.21
I have a project that has a presentation
and data
module. And I am trying to create the test component in the data module. I can generate the component for the presentation module. I am using kotlin-kts for the gradle build.
For the presentation moudle I have the following build.gradle.kts
plugins
id("com.android.application")
kotlin("android")
kotlin("kapt")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
applicationId = "nz.org.westforce.mobileui"
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.appCompat)
implementation(Libraries.kotlinStdlib)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
androidTestImplementation(TestLibraries.runner)
androidTestImplementation(TestLibraries.espressoCore)
testImplementation(TestLibraries.junit)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
implementation(project(":data"))
For the presentation module I have the following Application:
class WestforceCreditUnionMobileuiApplication
: Application(), HasActivityInjector
@Inject
lateinit var dispatchingAndroidActivityInjector: DispatchingAndroidInjector<Activity>
override fun onCreate()
super.onCreate()
DaggerWestforceCreditUnionMobileuiComponent.builder()
.application(this)
.build()
.inject(this)
override fun activityInjector(): AndroidInjector<Activity> =
dispatchingAndroidActivityInjector
The Component
@Singleton
@Component(modules = [AndroidSupportInjectionModule::class])
interface WestforceCreditUnionMobileuiComponent
@Component.Builder
interface Builder
@BindsInstance
fun application(application: WestforceCreditUnionMobileuiApplication): Builder
fun build(): WestforceCreditUnionMobileuiComponent
fun inject(application: WestforceCreditUnionMobileuiApplication)
The above is working and the DaggerWestforceCreditUnionMobileuiComponent
is generated
Now in my data
module I can trying to create a test component but dagger doesn't generate the test component classes.
I have the following test component in java/test/package/di
directory
@Singleton
@Component(modules = [TestNetworkModule::class])
interface TestWestforceCeditUnionComponent
fun inject(webServicesImpTest: WebServicesImpTest)
And in my test class:
class WebServicesImpTest
@Inject
private lateinit var webServicesImp: WebServicesImp
@Test
fun setUp()
/* the DaggerTestWestforceCreditUnionComponent is not generated */
I haven't specified the modules here as it will inflate the code here too much.
For my build.gradle.kts in the data module:
import org.gradle.kotlin.dsl.implementation
plugins
id("com.android.library")
id("kotlin-android")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.kotlinStdlib)
implementation(Libraries.appCompat)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
testImplementation(TestLibraries.junit)
testImplementation(TestLibraries.assertJ)
testImplementation(TestLibraries.mockitoKotlin)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
I am using the following dagger.android dependencies:
const val daggerAndroid = "com.google.dagger:dagger-android:$Versions.daggerAndroidVersion"
const val daggerCompiler = "com.google.dagger:dagger-compiler:$Versions.daggerAndroidVersion"
const val daggerProcessor = "com.google.dagger:dagger-android-processor:$Versions.daggerAndroidVersion"
const val daggerSupport = "com.google.dagger:dagger-android-support:$Versions.daggerAndroidVersion"
I have tried rebuilding the project and trying running the following task compileDebugUnitTestSources
Everything builds successfully,
One think I am thinking about as I am using different android modules, maybe the data module cannot see the WestforceCreditUnionMobileuiApplication
in the presentation module.
Many thanks for any suggestions
android dagger-2 dagger
|
show 6 more comments
Android Studio 3.4
kotlin 1.3.0
dagger 2.21
I have a project that has a presentation
and data
module. And I am trying to create the test component in the data module. I can generate the component for the presentation module. I am using kotlin-kts for the gradle build.
For the presentation moudle I have the following build.gradle.kts
plugins
id("com.android.application")
kotlin("android")
kotlin("kapt")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
applicationId = "nz.org.westforce.mobileui"
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.appCompat)
implementation(Libraries.kotlinStdlib)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
androidTestImplementation(TestLibraries.runner)
androidTestImplementation(TestLibraries.espressoCore)
testImplementation(TestLibraries.junit)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
implementation(project(":data"))
For the presentation module I have the following Application:
class WestforceCreditUnionMobileuiApplication
: Application(), HasActivityInjector
@Inject
lateinit var dispatchingAndroidActivityInjector: DispatchingAndroidInjector<Activity>
override fun onCreate()
super.onCreate()
DaggerWestforceCreditUnionMobileuiComponent.builder()
.application(this)
.build()
.inject(this)
override fun activityInjector(): AndroidInjector<Activity> =
dispatchingAndroidActivityInjector
The Component
@Singleton
@Component(modules = [AndroidSupportInjectionModule::class])
interface WestforceCreditUnionMobileuiComponent
@Component.Builder
interface Builder
@BindsInstance
fun application(application: WestforceCreditUnionMobileuiApplication): Builder
fun build(): WestforceCreditUnionMobileuiComponent
fun inject(application: WestforceCreditUnionMobileuiApplication)
The above is working and the DaggerWestforceCreditUnionMobileuiComponent
is generated
Now in my data
module I can trying to create a test component but dagger doesn't generate the test component classes.
I have the following test component in java/test/package/di
directory
@Singleton
@Component(modules = [TestNetworkModule::class])
interface TestWestforceCeditUnionComponent
fun inject(webServicesImpTest: WebServicesImpTest)
And in my test class:
class WebServicesImpTest
@Inject
private lateinit var webServicesImp: WebServicesImp
@Test
fun setUp()
/* the DaggerTestWestforceCreditUnionComponent is not generated */
I haven't specified the modules here as it will inflate the code here too much.
For my build.gradle.kts in the data module:
import org.gradle.kotlin.dsl.implementation
plugins
id("com.android.library")
id("kotlin-android")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.kotlinStdlib)
implementation(Libraries.appCompat)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
testImplementation(TestLibraries.junit)
testImplementation(TestLibraries.assertJ)
testImplementation(TestLibraries.mockitoKotlin)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
I am using the following dagger.android dependencies:
const val daggerAndroid = "com.google.dagger:dagger-android:$Versions.daggerAndroidVersion"
const val daggerCompiler = "com.google.dagger:dagger-compiler:$Versions.daggerAndroidVersion"
const val daggerProcessor = "com.google.dagger:dagger-android-processor:$Versions.daggerAndroidVersion"
const val daggerSupport = "com.google.dagger:dagger-android-support:$Versions.daggerAndroidVersion"
I have tried rebuilding the project and trying running the following task compileDebugUnitTestSources
Everything builds successfully,
One think I am thinking about as I am using different android modules, maybe the data module cannot see the WestforceCreditUnionMobileuiApplication
in the presentation module.
Many thanks for any suggestions
android dagger-2 dagger
Can you try to runassembleAndroidTest
– Skizo-ozᴉʞS
Mar 26 at 20:09
I have actually tried that already. I think the problem is because I have 2 android modulespresentation
anddata
The Application is in the presentation and maybe thedata
module cannot see that.
– ant2009
Mar 27 at 1:14
Where do you place thisTestWestforceCeditUnionComponent
?
– Archie G. Quiñones
Mar 27 at 2:02
1
@ant2009, I've downloaded Android Studio 3.4 RC2, but I'm unable to import the project (master
branch). Can you tell what I'm missing in your setup? What's the problem with my import?
– azizbekian
Mar 28 at 14:08
1
@ant2009, I'm sorry that I couldn't help. As long as Dmide posted an answer it's obvious that he was able to build the project, hence the problem is in my setup. Hope Dmide's solution works for you.
– azizbekian
Mar 28 at 19:32
|
show 6 more comments
Android Studio 3.4
kotlin 1.3.0
dagger 2.21
I have a project that has a presentation
and data
module. And I am trying to create the test component in the data module. I can generate the component for the presentation module. I am using kotlin-kts for the gradle build.
For the presentation moudle I have the following build.gradle.kts
plugins
id("com.android.application")
kotlin("android")
kotlin("kapt")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
applicationId = "nz.org.westforce.mobileui"
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.appCompat)
implementation(Libraries.kotlinStdlib)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
androidTestImplementation(TestLibraries.runner)
androidTestImplementation(TestLibraries.espressoCore)
testImplementation(TestLibraries.junit)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
implementation(project(":data"))
For the presentation module I have the following Application:
class WestforceCreditUnionMobileuiApplication
: Application(), HasActivityInjector
@Inject
lateinit var dispatchingAndroidActivityInjector: DispatchingAndroidInjector<Activity>
override fun onCreate()
super.onCreate()
DaggerWestforceCreditUnionMobileuiComponent.builder()
.application(this)
.build()
.inject(this)
override fun activityInjector(): AndroidInjector<Activity> =
dispatchingAndroidActivityInjector
The Component
@Singleton
@Component(modules = [AndroidSupportInjectionModule::class])
interface WestforceCreditUnionMobileuiComponent
@Component.Builder
interface Builder
@BindsInstance
fun application(application: WestforceCreditUnionMobileuiApplication): Builder
fun build(): WestforceCreditUnionMobileuiComponent
fun inject(application: WestforceCreditUnionMobileuiApplication)
The above is working and the DaggerWestforceCreditUnionMobileuiComponent
is generated
Now in my data
module I can trying to create a test component but dagger doesn't generate the test component classes.
I have the following test component in java/test/package/di
directory
@Singleton
@Component(modules = [TestNetworkModule::class])
interface TestWestforceCeditUnionComponent
fun inject(webServicesImpTest: WebServicesImpTest)
And in my test class:
class WebServicesImpTest
@Inject
private lateinit var webServicesImp: WebServicesImp
@Test
fun setUp()
/* the DaggerTestWestforceCreditUnionComponent is not generated */
I haven't specified the modules here as it will inflate the code here too much.
For my build.gradle.kts in the data module:
import org.gradle.kotlin.dsl.implementation
plugins
id("com.android.library")
id("kotlin-android")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.kotlinStdlib)
implementation(Libraries.appCompat)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
testImplementation(TestLibraries.junit)
testImplementation(TestLibraries.assertJ)
testImplementation(TestLibraries.mockitoKotlin)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
I am using the following dagger.android dependencies:
const val daggerAndroid = "com.google.dagger:dagger-android:$Versions.daggerAndroidVersion"
const val daggerCompiler = "com.google.dagger:dagger-compiler:$Versions.daggerAndroidVersion"
const val daggerProcessor = "com.google.dagger:dagger-android-processor:$Versions.daggerAndroidVersion"
const val daggerSupport = "com.google.dagger:dagger-android-support:$Versions.daggerAndroidVersion"
I have tried rebuilding the project and trying running the following task compileDebugUnitTestSources
Everything builds successfully,
One think I am thinking about as I am using different android modules, maybe the data module cannot see the WestforceCreditUnionMobileuiApplication
in the presentation module.
Many thanks for any suggestions
android dagger-2 dagger
Android Studio 3.4
kotlin 1.3.0
dagger 2.21
I have a project that has a presentation
and data
module. And I am trying to create the test component in the data module. I can generate the component for the presentation module. I am using kotlin-kts for the gradle build.
For the presentation moudle I have the following build.gradle.kts
plugins
id("com.android.application")
kotlin("android")
kotlin("kapt")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
applicationId = "nz.org.westforce.mobileui"
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.appCompat)
implementation(Libraries.kotlinStdlib)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
androidTestImplementation(TestLibraries.runner)
androidTestImplementation(TestLibraries.espressoCore)
testImplementation(TestLibraries.junit)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
implementation(project(":data"))
For the presentation module I have the following Application:
class WestforceCreditUnionMobileuiApplication
: Application(), HasActivityInjector
@Inject
lateinit var dispatchingAndroidActivityInjector: DispatchingAndroidInjector<Activity>
override fun onCreate()
super.onCreate()
DaggerWestforceCreditUnionMobileuiComponent.builder()
.application(this)
.build()
.inject(this)
override fun activityInjector(): AndroidInjector<Activity> =
dispatchingAndroidActivityInjector
The Component
@Singleton
@Component(modules = [AndroidSupportInjectionModule::class])
interface WestforceCreditUnionMobileuiComponent
@Component.Builder
interface Builder
@BindsInstance
fun application(application: WestforceCreditUnionMobileuiApplication): Builder
fun build(): WestforceCreditUnionMobileuiComponent
fun inject(application: WestforceCreditUnionMobileuiApplication)
The above is working and the DaggerWestforceCreditUnionMobileuiComponent
is generated
Now in my data
module I can trying to create a test component but dagger doesn't generate the test component classes.
I have the following test component in java/test/package/di
directory
@Singleton
@Component(modules = [TestNetworkModule::class])
interface TestWestforceCeditUnionComponent
fun inject(webServicesImpTest: WebServicesImpTest)
And in my test class:
class WebServicesImpTest
@Inject
private lateinit var webServicesImp: WebServicesImp
@Test
fun setUp()
/* the DaggerTestWestforceCreditUnionComponent is not generated */
I haven't specified the modules here as it will inflate the code here too much.
For my build.gradle.kts in the data module:
import org.gradle.kotlin.dsl.implementation
plugins
id("com.android.library")
id("kotlin-android")
android
compileSdkVersion(Versions.compileSdkVersion)
defaultConfig
minSdkVersion(Versions.minSdkVersion)
targetSdkVersion(Versions.targetSdkVersion)
versionCode = Versions.versionCode
versionName = Versions.versionName
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
buildTypes
getByName("release")
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
dependencies
implementation(Libraries.kotlinStdlib)
implementation(Libraries.appCompat)
implementation(Libraries.daggerAndroid)
implementation(Libraries.daggerSupport)
kapt(Libraries.daggerCompiler)
kapt(Libraries.daggerProcessor)
testImplementation(TestLibraries.junit)
testImplementation(TestLibraries.assertJ)
testImplementation(TestLibraries.mockitoKotlin)
testImplementation(Libraries.daggerAndroid)
testImplementation(Libraries.daggerSupport)
kaptTest(Libraries.daggerCompiler)
kaptTest(Libraries.daggerProcessor)
I am using the following dagger.android dependencies:
const val daggerAndroid = "com.google.dagger:dagger-android:$Versions.daggerAndroidVersion"
const val daggerCompiler = "com.google.dagger:dagger-compiler:$Versions.daggerAndroidVersion"
const val daggerProcessor = "com.google.dagger:dagger-android-processor:$Versions.daggerAndroidVersion"
const val daggerSupport = "com.google.dagger:dagger-android-support:$Versions.daggerAndroidVersion"
I have tried rebuilding the project and trying running the following task compileDebugUnitTestSources
Everything builds successfully,
One think I am thinking about as I am using different android modules, maybe the data module cannot see the WestforceCreditUnionMobileuiApplication
in the presentation module.
Many thanks for any suggestions
android dagger-2 dagger
android dagger-2 dagger
edited Mar 27 at 1:17
ant2009
asked Mar 24 at 2:15
ant2009ant2009
492117327513
492117327513
Can you try to runassembleAndroidTest
– Skizo-ozᴉʞS
Mar 26 at 20:09
I have actually tried that already. I think the problem is because I have 2 android modulespresentation
anddata
The Application is in the presentation and maybe thedata
module cannot see that.
– ant2009
Mar 27 at 1:14
Where do you place thisTestWestforceCeditUnionComponent
?
– Archie G. Quiñones
Mar 27 at 2:02
1
@ant2009, I've downloaded Android Studio 3.4 RC2, but I'm unable to import the project (master
branch). Can you tell what I'm missing in your setup? What's the problem with my import?
– azizbekian
Mar 28 at 14:08
1
@ant2009, I'm sorry that I couldn't help. As long as Dmide posted an answer it's obvious that he was able to build the project, hence the problem is in my setup. Hope Dmide's solution works for you.
– azizbekian
Mar 28 at 19:32
|
show 6 more comments
Can you try to runassembleAndroidTest
– Skizo-ozᴉʞS
Mar 26 at 20:09
I have actually tried that already. I think the problem is because I have 2 android modulespresentation
anddata
The Application is in the presentation and maybe thedata
module cannot see that.
– ant2009
Mar 27 at 1:14
Where do you place thisTestWestforceCeditUnionComponent
?
– Archie G. Quiñones
Mar 27 at 2:02
1
@ant2009, I've downloaded Android Studio 3.4 RC2, but I'm unable to import the project (master
branch). Can you tell what I'm missing in your setup? What's the problem with my import?
– azizbekian
Mar 28 at 14:08
1
@ant2009, I'm sorry that I couldn't help. As long as Dmide posted an answer it's obvious that he was able to build the project, hence the problem is in my setup. Hope Dmide's solution works for you.
– azizbekian
Mar 28 at 19:32
Can you try to run
assembleAndroidTest
– Skizo-ozᴉʞS
Mar 26 at 20:09
Can you try to run
assembleAndroidTest
– Skizo-ozᴉʞS
Mar 26 at 20:09
I have actually tried that already. I think the problem is because I have 2 android modules
presentation
and data
The Application is in the presentation and maybe the data
module cannot see that.– ant2009
Mar 27 at 1:14
I have actually tried that already. I think the problem is because I have 2 android modules
presentation
and data
The Application is in the presentation and maybe the data
module cannot see that.– ant2009
Mar 27 at 1:14
Where do you place this
TestWestforceCeditUnionComponent
?– Archie G. Quiñones
Mar 27 at 2:02
Where do you place this
TestWestforceCeditUnionComponent
?– Archie G. Quiñones
Mar 27 at 2:02
1
1
@ant2009, I've downloaded Android Studio 3.4 RC2, but I'm unable to import the project (
master
branch). Can you tell what I'm missing in your setup? What's the problem with my import?– azizbekian
Mar 28 at 14:08
@ant2009, I've downloaded Android Studio 3.4 RC2, but I'm unable to import the project (
master
branch). Can you tell what I'm missing in your setup? What's the problem with my import?– azizbekian
Mar 28 at 14:08
1
1
@ant2009, I'm sorry that I couldn't help. As long as Dmide posted an answer it's obvious that he was able to build the project, hence the problem is in my setup. Hope Dmide's solution works for you.
– azizbekian
Mar 28 at 19:32
@ant2009, I'm sorry that I couldn't help. As long as Dmide posted an answer it's obvious that he was able to build the project, hence the problem is in my setup. Hope Dmide's solution works for you.
– azizbekian
Mar 28 at 19:32
|
show 6 more comments
1 Answer
1
active
oldest
votes
You forgot to add
kotlin("kapt")
to plugins
section in :data
module build.gradle.kts.
Gradle then proceeds with errors about missing @Provides
for your WebServicesImp
. Also you should fix the missing Context
provider, in my example I just removed the Context
use. This should be added to TestNetworkModule
:
@Singleton
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit
return Retrofit.Builder()
.baseUrl("http://www.holidaywebservice.com")
.client(okHttpClient)
.addConverterFactory(SimpleXmlConverterFactory.createNonStrict(Persister(AnnotationStrategy())))
.build()
@Reusable
@Provides
fun provideWebServices(retrofit: Retrofit): WebServices
return retrofit.create(WebServices::class.java)
@Reusable
@Provides
fun provideWebServicesImp(webServices : WebServices): WebServicesImp
return WebServicesImp(webServices)
After that DaggerTestWestforceCeditUnionComponent
was successfully generated.
Thanks, that worked, thanks for the help.plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?
– ant2009
Mar 29 at 17:18
1
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320163%2fdagger-test-component-not-being-generated-when-the-project-contains-multiple-and%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You forgot to add
kotlin("kapt")
to plugins
section in :data
module build.gradle.kts.
Gradle then proceeds with errors about missing @Provides
for your WebServicesImp
. Also you should fix the missing Context
provider, in my example I just removed the Context
use. This should be added to TestNetworkModule
:
@Singleton
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit
return Retrofit.Builder()
.baseUrl("http://www.holidaywebservice.com")
.client(okHttpClient)
.addConverterFactory(SimpleXmlConverterFactory.createNonStrict(Persister(AnnotationStrategy())))
.build()
@Reusable
@Provides
fun provideWebServices(retrofit: Retrofit): WebServices
return retrofit.create(WebServices::class.java)
@Reusable
@Provides
fun provideWebServicesImp(webServices : WebServices): WebServicesImp
return WebServicesImp(webServices)
After that DaggerTestWestforceCeditUnionComponent
was successfully generated.
Thanks, that worked, thanks for the help.plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?
– ant2009
Mar 29 at 17:18
1
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
add a comment |
You forgot to add
kotlin("kapt")
to plugins
section in :data
module build.gradle.kts.
Gradle then proceeds with errors about missing @Provides
for your WebServicesImp
. Also you should fix the missing Context
provider, in my example I just removed the Context
use. This should be added to TestNetworkModule
:
@Singleton
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit
return Retrofit.Builder()
.baseUrl("http://www.holidaywebservice.com")
.client(okHttpClient)
.addConverterFactory(SimpleXmlConverterFactory.createNonStrict(Persister(AnnotationStrategy())))
.build()
@Reusable
@Provides
fun provideWebServices(retrofit: Retrofit): WebServices
return retrofit.create(WebServices::class.java)
@Reusable
@Provides
fun provideWebServicesImp(webServices : WebServices): WebServicesImp
return WebServicesImp(webServices)
After that DaggerTestWestforceCeditUnionComponent
was successfully generated.
Thanks, that worked, thanks for the help.plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?
– ant2009
Mar 29 at 17:18
1
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
add a comment |
You forgot to add
kotlin("kapt")
to plugins
section in :data
module build.gradle.kts.
Gradle then proceeds with errors about missing @Provides
for your WebServicesImp
. Also you should fix the missing Context
provider, in my example I just removed the Context
use. This should be added to TestNetworkModule
:
@Singleton
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit
return Retrofit.Builder()
.baseUrl("http://www.holidaywebservice.com")
.client(okHttpClient)
.addConverterFactory(SimpleXmlConverterFactory.createNonStrict(Persister(AnnotationStrategy())))
.build()
@Reusable
@Provides
fun provideWebServices(retrofit: Retrofit): WebServices
return retrofit.create(WebServices::class.java)
@Reusable
@Provides
fun provideWebServicesImp(webServices : WebServices): WebServicesImp
return WebServicesImp(webServices)
After that DaggerTestWestforceCeditUnionComponent
was successfully generated.
You forgot to add
kotlin("kapt")
to plugins
section in :data
module build.gradle.kts.
Gradle then proceeds with errors about missing @Provides
for your WebServicesImp
. Also you should fix the missing Context
provider, in my example I just removed the Context
use. This should be added to TestNetworkModule
:
@Singleton
@Provides
fun provideRetrofit(okHttpClient: OkHttpClient): Retrofit
return Retrofit.Builder()
.baseUrl("http://www.holidaywebservice.com")
.client(okHttpClient)
.addConverterFactory(SimpleXmlConverterFactory.createNonStrict(Persister(AnnotationStrategy())))
.build()
@Reusable
@Provides
fun provideWebServices(retrofit: Retrofit): WebServices
return retrofit.create(WebServices::class.java)
@Reusable
@Provides
fun provideWebServicesImp(webServices : WebServices): WebServicesImp
return WebServicesImp(webServices)
After that DaggerTestWestforceCeditUnionComponent
was successfully generated.
edited Mar 30 at 10:25
answered Mar 28 at 16:41
DmideDmide
5,62931728
5,62931728
Thanks, that worked, thanks for the help.plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?
– ant2009
Mar 29 at 17:18
1
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
add a comment |
Thanks, that worked, thanks for the help.plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?
– ant2009
Mar 29 at 17:18
1
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
Thanks, that worked, thanks for the help.
plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?– ant2009
Mar 29 at 17:18
Thanks, that worked, thanks for the help.
plugins id("com.android.library") id("kotlin-android") kotlin("android") kotlin("kapt")
I have added above plugins. I have some confusion about those. Can you explain about them?– ant2009
Mar 29 at 17:18
1
1
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
kotlin("android") enables kotlin support in this module (id("kotlin-android") is the same but different method), kotlin("kapt") enables annotation processing in this module, which is requred for dagger to work.
– Dmide
Mar 29 at 17:42
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320163%2fdagger-test-component-not-being-generated-when-the-project-contains-multiple-and%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you try to run
assembleAndroidTest
– Skizo-ozᴉʞS
Mar 26 at 20:09
I have actually tried that already. I think the problem is because I have 2 android modules
presentation
anddata
The Application is in the presentation and maybe thedata
module cannot see that.– ant2009
Mar 27 at 1:14
Where do you place this
TestWestforceCeditUnionComponent
?– Archie G. Quiñones
Mar 27 at 2:02
1
@ant2009, I've downloaded Android Studio 3.4 RC2, but I'm unable to import the project (
master
branch). Can you tell what I'm missing in your setup? What's the problem with my import?– azizbekian
Mar 28 at 14:08
1
@ant2009, I'm sorry that I couldn't help. As long as Dmide posted an answer it's obvious that he was able to build the project, hence the problem is in my setup. Hope Dmide's solution works for you.
– azizbekian
Mar 28 at 19:32