Converting android java project to android kotlin projectIs there a way to run Python on Android?How do save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?Is there a unique Android device ID?What is 'Context' on Android?Proper use cases for Android UserManager.isUserAGoat()?“Prefer to run the dagger processor over that class instead” in KotlinAndroid Library, Kotlin and Dagger2No acceptable module found TextRecognizer

Can a nothic's Weird Insight action discover secrets about a player character that the character doesn't know about themselves?

Should I mention being denied entry to UK due to a confusion in my Visa and Ticket bookings?

How does this change to the opportunity attack rule impact combat?

What happens if you dump antimatter into a black hole?

Why do people keep telling me that I am a bad photographer?

Understanding trademark infringements in a world where many dictionary words are trademarks?

Has a commercial or military jet bi-plane ever been manufactured?

What is the most remote airport from the center of the city it supposedly serves?

Can my company stop me from working overtime?

Why Isn’t SQL More Refactorable?

Why do money exchangers give different rates to different bills?

How can modem speed be 10 times slower than router?

How to safely wipe a USB flash drive

Why doesn't WotC use established keywords on all new cards?

How can I close a gap between my fence and my neighbor's that's on his side of the property line?

Position of past participle and extent of the Verbklammer

Are there any Final Fantasy Spirits in Super Smash Bros Ultimate?

Getting a W on your transcript for grad school applications

How do I overfit?

What are the differences between credential stuffing and password spraying?

Building a list of products from the elements in another list

How long would it take for people to notice a mass disappearance?

Shantae Dance Matching

Purpose of のは in this sentence?



Converting android java project to android kotlin project


Is there a way to run Python on Android?How do save an Android Activity state using save instance state?Close/hide the Android Soft KeyboardWhy is the Android emulator so slow? How can we speed up the Android emulator?Is there a unique Android device ID?What is 'Context' on Android?Proper use cases for Android UserManager.isUserAGoat()?“Prefer to run the dagger processor over that class instead” in KotlinAndroid Library, Kotlin and Dagger2No acceptable module found TextRecognizer






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have decided a few weeks ago to start converting my existing app (I wrote it in java) to kotlin.
I converted only one activity and I wanted to check the functionality before I will move forward and change all of my classes.
Unfortunately I'm getting the following error:



Unresolved reference: DaggerSearchComponent


This is how I resolve my dependencies with this activity, this code will be called from within the onCreate method:



SearchActivity.kt



 override fun resolveDependency() 
DaggerSearchComponent.builder()
.applicationComponent(applicationComponent)
.searchModule(SearchModule(this))
.build().inject(this)




SearchComponent.java



@PerActivity
@Component(modules = SearchModule.class, dependencies = ApplicationComponent.class)
public interface SearchComponent

void inject(SearchActivity activity);




The component of this activity is still written with java, although I tried to convert it with kotlin but I got the same error.



I added kotlin plugin in my build.gradle (Module:app)



apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'


build.gradle(project)



 apply plugin: 'kotlin-kapt'

buildscript
ext.kotlin_version = '1.3.21'

repositories
google()
jcenter()

dependencies
classpath 'com.android.tools.build:gradle:3.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files



allprojects
repositories
google()
jcenter()



task clean(type: Delete)
delete rootProject.buildDir



I did not find any other useful information except for adding kotlin plugin the app gradle file but it did not work for me.



When using dagger2 is it possible to use kotlin with java or should I need to convert every component/module into kotlin before testing it?










share|improve this question




























    0















    I have decided a few weeks ago to start converting my existing app (I wrote it in java) to kotlin.
    I converted only one activity and I wanted to check the functionality before I will move forward and change all of my classes.
    Unfortunately I'm getting the following error:



    Unresolved reference: DaggerSearchComponent


    This is how I resolve my dependencies with this activity, this code will be called from within the onCreate method:



    SearchActivity.kt



     override fun resolveDependency() 
    DaggerSearchComponent.builder()
    .applicationComponent(applicationComponent)
    .searchModule(SearchModule(this))
    .build().inject(this)




    SearchComponent.java



    @PerActivity
    @Component(modules = SearchModule.class, dependencies = ApplicationComponent.class)
    public interface SearchComponent

    void inject(SearchActivity activity);




    The component of this activity is still written with java, although I tried to convert it with kotlin but I got the same error.



    I added kotlin plugin in my build.gradle (Module:app)



    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'kotlin-android'


    build.gradle(project)



     apply plugin: 'kotlin-kapt'

    buildscript
    ext.kotlin_version = '1.3.21'

    repositories
    google()
    jcenter()

    dependencies
    classpath 'com.android.tools.build:gradle:3.3.2'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files



    allprojects
    repositories
    google()
    jcenter()



    task clean(type: Delete)
    delete rootProject.buildDir



    I did not find any other useful information except for adding kotlin plugin the app gradle file but it did not work for me.



    When using dagger2 is it possible to use kotlin with java or should I need to convert every component/module into kotlin before testing it?










    share|improve this question
























      0












      0








      0








      I have decided a few weeks ago to start converting my existing app (I wrote it in java) to kotlin.
      I converted only one activity and I wanted to check the functionality before I will move forward and change all of my classes.
      Unfortunately I'm getting the following error:



      Unresolved reference: DaggerSearchComponent


      This is how I resolve my dependencies with this activity, this code will be called from within the onCreate method:



      SearchActivity.kt



       override fun resolveDependency() 
      DaggerSearchComponent.builder()
      .applicationComponent(applicationComponent)
      .searchModule(SearchModule(this))
      .build().inject(this)




      SearchComponent.java



      @PerActivity
      @Component(modules = SearchModule.class, dependencies = ApplicationComponent.class)
      public interface SearchComponent

      void inject(SearchActivity activity);




      The component of this activity is still written with java, although I tried to convert it with kotlin but I got the same error.



      I added kotlin plugin in my build.gradle (Module:app)



      apply plugin: 'com.android.application'
      apply plugin: 'kotlin-android-extensions'
      apply plugin: 'kotlin-android'


      build.gradle(project)



       apply plugin: 'kotlin-kapt'

      buildscript
      ext.kotlin_version = '1.3.21'

      repositories
      google()
      jcenter()

      dependencies
      classpath 'com.android.tools.build:gradle:3.3.2'
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
      classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files



      allprojects
      repositories
      google()
      jcenter()



      task clean(type: Delete)
      delete rootProject.buildDir



      I did not find any other useful information except for adding kotlin plugin the app gradle file but it did not work for me.



      When using dagger2 is it possible to use kotlin with java or should I need to convert every component/module into kotlin before testing it?










      share|improve this question














      I have decided a few weeks ago to start converting my existing app (I wrote it in java) to kotlin.
      I converted only one activity and I wanted to check the functionality before I will move forward and change all of my classes.
      Unfortunately I'm getting the following error:



      Unresolved reference: DaggerSearchComponent


      This is how I resolve my dependencies with this activity, this code will be called from within the onCreate method:



      SearchActivity.kt



       override fun resolveDependency() 
      DaggerSearchComponent.builder()
      .applicationComponent(applicationComponent)
      .searchModule(SearchModule(this))
      .build().inject(this)




      SearchComponent.java



      @PerActivity
      @Component(modules = SearchModule.class, dependencies = ApplicationComponent.class)
      public interface SearchComponent

      void inject(SearchActivity activity);




      The component of this activity is still written with java, although I tried to convert it with kotlin but I got the same error.



      I added kotlin plugin in my build.gradle (Module:app)



      apply plugin: 'com.android.application'
      apply plugin: 'kotlin-android-extensions'
      apply plugin: 'kotlin-android'


      build.gradle(project)



       apply plugin: 'kotlin-kapt'

      buildscript
      ext.kotlin_version = '1.3.21'

      repositories
      google()
      jcenter()

      dependencies
      classpath 'com.android.tools.build:gradle:3.3.2'
      classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
      classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
      // NOTE: Do not place your application dependencies here; they belong
      // in the individual module build.gradle files



      allprojects
      repositories
      google()
      jcenter()



      task clean(type: Delete)
      delete rootProject.buildDir



      I did not find any other useful information except for adding kotlin plugin the app gradle file but it did not work for me.



      When using dagger2 is it possible to use kotlin with java or should I need to convert every component/module into kotlin before testing it?







      android kotlin dagger-2






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 22 at 22:46









      Anton MakovAnton Makov

      2291316




      2291316






















          1 Answer
          1






          active

          oldest

          votes


















          2














          Make sure you added these dependencies in module gradle:



          implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
          implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
          implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
          kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
          kapt "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
          testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"


          And add



          apply plugin: 'kotlin-kapt'


          also to module level gradle.



          Make changes in SearchComponent(Kotlin)



          @PerActivity
          @Component(modules = [SearchModule.class::class], dependencies = [ApplicationComponent::class])
          interface SearchComponent

          fun inject(application: Application)







          share|improve this answer

























            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
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308742%2fconverting-android-java-project-to-android-kotlin-project%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









            2














            Make sure you added these dependencies in module gradle:



            implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
            implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
            implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
            kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
            kapt "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
            testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"


            And add



            apply plugin: 'kotlin-kapt'


            also to module level gradle.



            Make changes in SearchComponent(Kotlin)



            @PerActivity
            @Component(modules = [SearchModule.class::class], dependencies = [ApplicationComponent::class])
            interface SearchComponent

            fun inject(application: Application)







            share|improve this answer





























              2














              Make sure you added these dependencies in module gradle:



              implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
              implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
              implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
              kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
              kapt "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
              testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"


              And add



              apply plugin: 'kotlin-kapt'


              also to module level gradle.



              Make changes in SearchComponent(Kotlin)



              @PerActivity
              @Component(modules = [SearchModule.class::class], dependencies = [ApplicationComponent::class])
              interface SearchComponent

              fun inject(application: Application)







              share|improve this answer



























                2












                2








                2







                Make sure you added these dependencies in module gradle:



                implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
                implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
                implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
                kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
                kapt "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
                testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"


                And add



                apply plugin: 'kotlin-kapt'


                also to module level gradle.



                Make changes in SearchComponent(Kotlin)



                @PerActivity
                @Component(modules = [SearchModule.class::class], dependencies = [ApplicationComponent::class])
                interface SearchComponent

                fun inject(application: Application)







                share|improve this answer















                Make sure you added these dependencies in module gradle:



                implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
                implementation "com.google.dagger:dagger-android:$rootProject.dagger2Version"
                implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
                kapt "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
                kapt "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
                testAnnotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"


                And add



                apply plugin: 'kotlin-kapt'


                also to module level gradle.



                Make changes in SearchComponent(Kotlin)



                @PerActivity
                @Component(modules = [SearchModule.class::class], dependencies = [ApplicationComponent::class])
                interface SearchComponent

                fun inject(application: Application)








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 22 at 23:06

























                answered Mar 22 at 23:01









                Amrat SinghAmrat Singh

                238211




                238211





























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308742%2fconverting-android-java-project-to-android-kotlin-project%23new-answer', 'question_page');

                    );

                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript