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…'
How do I deal with too many NPCs in my campaign?
If the EU does not offer an extension to UK's Article 50 invocation, is the Benn Bill irrelevant?
What's the lowest risk highest reward I can invest in for 5 years?
In a folk jam session, when asked which key my non-transposing chromatic instrument (like a violin) is in, what do I answer?
What's the story to "WotC gave up on fixing Polymorph"?
How to deal with a Homophobic PC
Magneto 2 How to call Helper function in observer file
What is this utensil for?
To what extent is it worthwhile to report check fraud / refund scams?
Norwegian refuses EU delay (4.7 hours) compensation because it turned out there was nothing wrong with the aircraft
Is it true that, "just ten trading days represent 63 per cent of the returns of the past 50 years"?
Do we know the situation in Britain before Sealion (summer 1940)?
Meaning of 'ran' in German?
Guitar tuning (EADGBE), "perfect" fourths?
Does wetting a beer glass change the foam characteristics?
Cut a cake into 3 equal portions with only a knife
Is it a good idea to leave minor world details to the reader's imagination?
Can the U.S. president make military decisions without consulting anyone?
How do you use the interjection for snorting?
2000s Animated TV show where teenagers could physically go into a virtual world
Can a broken/split chain be reassembled?
Worms crawling under skin
Two trains move towards each other, a bird moves between them. How many trips can the bird make?
Hilbert's hotel: why can't I repeat it infinitely many times?
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 margin-bottom:0;
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
|
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
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 modulespresentationanddataThe Application is in the presentation and maybe thedatamodule 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 (masterbranch). 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 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
edited Mar 27 at 1:17
ant2009
asked Mar 24 at 2:15
ant2009ant2009
814123 gold badges332 silver badges519 bronze badges
814123 gold badges332 silver badges519 bronze badges
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 modulespresentationanddataThe Application is in the presentation and maybe thedatamodule 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 (masterbranch). 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 modulespresentationanddataThe Application is in the presentation and maybe thedatamodule 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 (masterbranch). 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/4.0/"u003ecc by-sa 4.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,7693 gold badges17 silver badges30 bronze badges
5,7693 gold badges17 silver badges30 bronze badges
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
presentationanddataThe Application is in the presentation and maybe thedatamodule 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 (
masterbranch). 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