Android Studio dependencies of module not visible in other module





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







0















I have a module called "Common" as library, this module has few dependencies like: com.badlogicgames.gdx, com.squareup.wire etc. And it works fine, I use them inside of this module.



And I have another module called "Tracking", where in the gradle I have:



dependencies {
compile project(':Common')
}


And if I try there to import any public class of module "Common", it works fine, but if I try to import any class of library com.badlogicgames.gdxor com.squareup.wire, it says me "Cannot resolve symbol ..." and hightlight it red. And no code autocompleting for such classes.



However the project compiles and starts on the device without errors.



Has somebody any idea? I tried "clean and rebuild" for project, "invalidate cashes and restart" for Android Studio. Nothing helps.










share|improve this question























  • You can refer this stackoverflow.com/questions/19067846/…

    – basavaraj ganagi
    Nov 22 '18 at 14:20











  • @basavarajganagi my Project Structure is ok, there are all modules and their dependencies.

    – Alexander Tumanin
    Nov 22 '18 at 14:24


















0















I have a module called "Common" as library, this module has few dependencies like: com.badlogicgames.gdx, com.squareup.wire etc. And it works fine, I use them inside of this module.



And I have another module called "Tracking", where in the gradle I have:



dependencies {
compile project(':Common')
}


And if I try there to import any public class of module "Common", it works fine, but if I try to import any class of library com.badlogicgames.gdxor com.squareup.wire, it says me "Cannot resolve symbol ..." and hightlight it red. And no code autocompleting for such classes.



However the project compiles and starts on the device without errors.



Has somebody any idea? I tried "clean and rebuild" for project, "invalidate cashes and restart" for Android Studio. Nothing helps.










share|improve this question























  • You can refer this stackoverflow.com/questions/19067846/…

    – basavaraj ganagi
    Nov 22 '18 at 14:20











  • @basavarajganagi my Project Structure is ok, there are all modules and their dependencies.

    – Alexander Tumanin
    Nov 22 '18 at 14:24














0












0








0








I have a module called "Common" as library, this module has few dependencies like: com.badlogicgames.gdx, com.squareup.wire etc. And it works fine, I use them inside of this module.



And I have another module called "Tracking", where in the gradle I have:



dependencies {
compile project(':Common')
}


And if I try there to import any public class of module "Common", it works fine, but if I try to import any class of library com.badlogicgames.gdxor com.squareup.wire, it says me "Cannot resolve symbol ..." and hightlight it red. And no code autocompleting for such classes.



However the project compiles and starts on the device without errors.



Has somebody any idea? I tried "clean and rebuild" for project, "invalidate cashes and restart" for Android Studio. Nothing helps.










share|improve this question














I have a module called "Common" as library, this module has few dependencies like: com.badlogicgames.gdx, com.squareup.wire etc. And it works fine, I use them inside of this module.



And I have another module called "Tracking", where in the gradle I have:



dependencies {
compile project(':Common')
}


And if I try there to import any public class of module "Common", it works fine, but if I try to import any class of library com.badlogicgames.gdxor com.squareup.wire, it says me "Cannot resolve symbol ..." and hightlight it red. And no code autocompleting for such classes.



However the project compiles and starts on the device without errors.



Has somebody any idea? I tried "clean and rebuild" for project, "invalidate cashes and restart" for Android Studio. Nothing helps.







android android-studio






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 14:13









Alexander TumaninAlexander Tumanin

8551426




8551426













  • You can refer this stackoverflow.com/questions/19067846/…

    – basavaraj ganagi
    Nov 22 '18 at 14:20











  • @basavarajganagi my Project Structure is ok, there are all modules and their dependencies.

    – Alexander Tumanin
    Nov 22 '18 at 14:24



















  • You can refer this stackoverflow.com/questions/19067846/…

    – basavaraj ganagi
    Nov 22 '18 at 14:20











  • @basavarajganagi my Project Structure is ok, there are all modules and their dependencies.

    – Alexander Tumanin
    Nov 22 '18 at 14:24

















You can refer this stackoverflow.com/questions/19067846/…

– basavaraj ganagi
Nov 22 '18 at 14:20





You can refer this stackoverflow.com/questions/19067846/…

– basavaraj ganagi
Nov 22 '18 at 14:20













@basavarajganagi my Project Structure is ok, there are all modules and their dependencies.

– Alexander Tumanin
Nov 22 '18 at 14:24





@basavarajganagi my Project Structure is ok, there are all modules and their dependencies.

– Alexander Tumanin
Nov 22 '18 at 14:24












2 Answers
2






active

oldest

votes


















0














in the module common you need to declare those transitive dependencies as api to expose them to other modules:



e.g. common/build.gradle:



dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
api 'com.squareup.wire'
}


https://jeroenmols.com/blog/2017/06/14/androidstudio3/






share|improve this answer































    0














    Solution



    Change compile to api



    dependencies {
    api project(':Common')
    }


    Reason



    Because compile is deprecated, so it is been treated as implementation.
    FYI compile and api (new keyword for compile) are same in which all internal modules are visible.
    But new gradle project having compile keyword are treated as implementation. and in implementation internal modules are not visible to main project.



    Suggestion



    You should declare dependency in your gradle because it is not good to make leak of internal modules.






    share|improve this answer


























    • I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

      – Alexander Tumanin
      Nov 22 '18 at 14:21











    • What is keyword other module using for declaring squareup.wire?

      – Khemraj
      Nov 22 '18 at 14:24











    • compile 'com.squareup.wire:wire-runtime:2.1.0'

      – Alexander Tumanin
      Nov 22 '18 at 14:25











    • You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

      – Khemraj
      Nov 22 '18 at 14:28











    • It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

      – Alexander Tumanin
      Nov 22 '18 at 14:31












    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%2f53432859%2fandroid-studio-dependencies-of-module-not-visible-in-other-module%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    in the module common you need to declare those transitive dependencies as api to expose them to other modules:



    e.g. common/build.gradle:



    dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    api 'com.squareup.wire'
    }


    https://jeroenmols.com/blog/2017/06/14/androidstudio3/






    share|improve this answer




























      0














      in the module common you need to declare those transitive dependencies as api to expose them to other modules:



      e.g. common/build.gradle:



      dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0'
      api 'com.squareup.wire'
      }


      https://jeroenmols.com/blog/2017/06/14/androidstudio3/






      share|improve this answer


























        0












        0








        0







        in the module common you need to declare those transitive dependencies as api to expose them to other modules:



        e.g. common/build.gradle:



        dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:28.0.0'
        api 'com.squareup.wire'
        }


        https://jeroenmols.com/blog/2017/06/14/androidstudio3/






        share|improve this answer













        in the module common you need to declare those transitive dependencies as api to expose them to other modules:



        e.g. common/build.gradle:



        dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:28.0.0'
        api 'com.squareup.wire'
        }


        https://jeroenmols.com/blog/2017/06/14/androidstudio3/







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 22 '18 at 14:20









        Milo BemMilo Bem

        822418




        822418

























            0














            Solution



            Change compile to api



            dependencies {
            api project(':Common')
            }


            Reason



            Because compile is deprecated, so it is been treated as implementation.
            FYI compile and api (new keyword for compile) are same in which all internal modules are visible.
            But new gradle project having compile keyword are treated as implementation. and in implementation internal modules are not visible to main project.



            Suggestion



            You should declare dependency in your gradle because it is not good to make leak of internal modules.






            share|improve this answer


























            • I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

              – Alexander Tumanin
              Nov 22 '18 at 14:21











            • What is keyword other module using for declaring squareup.wire?

              – Khemraj
              Nov 22 '18 at 14:24











            • compile 'com.squareup.wire:wire-runtime:2.1.0'

              – Alexander Tumanin
              Nov 22 '18 at 14:25











            • You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

              – Khemraj
              Nov 22 '18 at 14:28











            • It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

              – Alexander Tumanin
              Nov 22 '18 at 14:31
















            0














            Solution



            Change compile to api



            dependencies {
            api project(':Common')
            }


            Reason



            Because compile is deprecated, so it is been treated as implementation.
            FYI compile and api (new keyword for compile) are same in which all internal modules are visible.
            But new gradle project having compile keyword are treated as implementation. and in implementation internal modules are not visible to main project.



            Suggestion



            You should declare dependency in your gradle because it is not good to make leak of internal modules.






            share|improve this answer


























            • I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

              – Alexander Tumanin
              Nov 22 '18 at 14:21











            • What is keyword other module using for declaring squareup.wire?

              – Khemraj
              Nov 22 '18 at 14:24











            • compile 'com.squareup.wire:wire-runtime:2.1.0'

              – Alexander Tumanin
              Nov 22 '18 at 14:25











            • You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

              – Khemraj
              Nov 22 '18 at 14:28











            • It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

              – Alexander Tumanin
              Nov 22 '18 at 14:31














            0












            0








            0







            Solution



            Change compile to api



            dependencies {
            api project(':Common')
            }


            Reason



            Because compile is deprecated, so it is been treated as implementation.
            FYI compile and api (new keyword for compile) are same in which all internal modules are visible.
            But new gradle project having compile keyword are treated as implementation. and in implementation internal modules are not visible to main project.



            Suggestion



            You should declare dependency in your gradle because it is not good to make leak of internal modules.






            share|improve this answer















            Solution



            Change compile to api



            dependencies {
            api project(':Common')
            }


            Reason



            Because compile is deprecated, so it is been treated as implementation.
            FYI compile and api (new keyword for compile) are same in which all internal modules are visible.
            But new gradle project having compile keyword are treated as implementation. and in implementation internal modules are not visible to main project.



            Suggestion



            You should declare dependency in your gradle because it is not good to make leak of internal modules.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 22 '18 at 14:21

























            answered Nov 22 '18 at 14:20









            KhemrajKhemraj

            16.9k66590




            16.9k66590













            • I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

              – Alexander Tumanin
              Nov 22 '18 at 14:21











            • What is keyword other module using for declaring squareup.wire?

              – Khemraj
              Nov 22 '18 at 14:24











            • compile 'com.squareup.wire:wire-runtime:2.1.0'

              – Alexander Tumanin
              Nov 22 '18 at 14:25











            • You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

              – Khemraj
              Nov 22 '18 at 14:28











            • It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

              – Alexander Tumanin
              Nov 22 '18 at 14:31



















            • I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

              – Alexander Tumanin
              Nov 22 '18 at 14:21











            • What is keyword other module using for declaring squareup.wire?

              – Khemraj
              Nov 22 '18 at 14:24











            • compile 'com.squareup.wire:wire-runtime:2.1.0'

              – Alexander Tumanin
              Nov 22 '18 at 14:25











            • You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

              – Khemraj
              Nov 22 '18 at 14:28











            • It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

              – Alexander Tumanin
              Nov 22 '18 at 14:31

















            I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

            – Alexander Tumanin
            Nov 22 '18 at 14:21





            I use old gradle version distributionUrl=../../../../androidGradleDistribution/gradle-3.3-all.zip

            – Alexander Tumanin
            Nov 22 '18 at 14:21













            What is keyword other module using for declaring squareup.wire?

            – Khemraj
            Nov 22 '18 at 14:24





            What is keyword other module using for declaring squareup.wire?

            – Khemraj
            Nov 22 '18 at 14:24













            compile 'com.squareup.wire:wire-runtime:2.1.0'

            – Alexander Tumanin
            Nov 22 '18 at 14:25





            compile 'com.squareup.wire:wire-runtime:2.1.0'

            – Alexander Tumanin
            Nov 22 '18 at 14:25













            You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

            – Khemraj
            Nov 22 '18 at 14:28





            You must declare this dependency to your project too, perhaps this is AAR, which does not contain nested dependencies.

            – Khemraj
            Nov 22 '18 at 14:28













            It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

            – Alexander Tumanin
            Nov 22 '18 at 14:31





            It means I will have the same library twice in the project and the size of project increases. Strange is the thing, that it worked in the past, but last few days I get this problem.

            – Alexander Tumanin
            Nov 22 '18 at 14:31


















            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%2f53432859%2fandroid-studio-dependencies-of-module-not-visible-in-other-module%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

            mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

            How to change which sound is reproduced for terminal bell?

            Can I use Tabulator js library in my java Spring + Thymeleaf project?