implementation project ':app' in 'libModule' not working










0















I need to create module in Android Studio which will contain dependency on the main project. I create new project and module, add implementation to library gradle like next:



implementation project(':app')


but when I try to sync gradle, I got next errors:



Unable to resolve dependency for ':mylibrary@debug/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugAndroidTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugUnitTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@release/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@releaseUnitTest/compileClasspath': Could not resolve project :app.


Any ideas why it happens and how to fix it?



UPDATE



here is app gradle (pretty empty)



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

android
compileSdkVersion 28
defaultConfig
applicationId "com.pro100svitlo.testproject"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'



and here is library gradle:



apply plugin: 'com.android.library'

android
compileSdkVersion 28

defaultConfig
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"




dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':app')










share|improve this question
























  • you want to add library in second project ???

    – Ali
    Nov 16 '18 at 6:06











  • I need library, which will know about main project code

    – Andriy Antonov
    Nov 16 '18 at 6:08











  • Can you post your build.gradle file?

    – p.alexey
    Nov 16 '18 at 6:25











  • @p.alexey please, take a look. I update my question with gradle files

    – Andriy Antonov
    Nov 16 '18 at 6:28











  • Did you try to add kotlin into your library module?

    – p.alexey
    Nov 16 '18 at 6:41















0















I need to create module in Android Studio which will contain dependency on the main project. I create new project and module, add implementation to library gradle like next:



implementation project(':app')


but when I try to sync gradle, I got next errors:



Unable to resolve dependency for ':mylibrary@debug/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugAndroidTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugUnitTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@release/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@releaseUnitTest/compileClasspath': Could not resolve project :app.


Any ideas why it happens and how to fix it?



UPDATE



here is app gradle (pretty empty)



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

android
compileSdkVersion 28
defaultConfig
applicationId "com.pro100svitlo.testproject"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'



and here is library gradle:



apply plugin: 'com.android.library'

android
compileSdkVersion 28

defaultConfig
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"




dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':app')










share|improve this question
























  • you want to add library in second project ???

    – Ali
    Nov 16 '18 at 6:06











  • I need library, which will know about main project code

    – Andriy Antonov
    Nov 16 '18 at 6:08











  • Can you post your build.gradle file?

    – p.alexey
    Nov 16 '18 at 6:25











  • @p.alexey please, take a look. I update my question with gradle files

    – Andriy Antonov
    Nov 16 '18 at 6:28











  • Did you try to add kotlin into your library module?

    – p.alexey
    Nov 16 '18 at 6:41













0












0








0








I need to create module in Android Studio which will contain dependency on the main project. I create new project and module, add implementation to library gradle like next:



implementation project(':app')


but when I try to sync gradle, I got next errors:



Unable to resolve dependency for ':mylibrary@debug/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugAndroidTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugUnitTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@release/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@releaseUnitTest/compileClasspath': Could not resolve project :app.


Any ideas why it happens and how to fix it?



UPDATE



here is app gradle (pretty empty)



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

android
compileSdkVersion 28
defaultConfig
applicationId "com.pro100svitlo.testproject"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'



and here is library gradle:



apply plugin: 'com.android.library'

android
compileSdkVersion 28

defaultConfig
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"




dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':app')










share|improve this question
















I need to create module in Android Studio which will contain dependency on the main project. I create new project and module, add implementation to library gradle like next:



implementation project(':app')


but when I try to sync gradle, I got next errors:



Unable to resolve dependency for ':mylibrary@debug/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugAndroidTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@debugUnitTest/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@release/compileClasspath': Could not resolve project :app.

Unable to resolve dependency for ':mylibrary@releaseUnitTest/compileClasspath': Could not resolve project :app.


Any ideas why it happens and how to fix it?



UPDATE



here is app gradle (pretty empty)



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

android
compileSdkVersion 28
defaultConfig
applicationId "com.pro100svitlo.testproject"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

buildTypes
release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'




dependencies
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'



and here is library gradle:



apply plugin: 'com.android.library'

android
compileSdkVersion 28

defaultConfig
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"




dependencies
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':app')







android gradle android-library android-module






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 '18 at 6:27







Andriy Antonov

















asked Nov 16 '18 at 6:03









Andriy AntonovAndriy Antonov

421516




421516












  • you want to add library in second project ???

    – Ali
    Nov 16 '18 at 6:06











  • I need library, which will know about main project code

    – Andriy Antonov
    Nov 16 '18 at 6:08











  • Can you post your build.gradle file?

    – p.alexey
    Nov 16 '18 at 6:25











  • @p.alexey please, take a look. I update my question with gradle files

    – Andriy Antonov
    Nov 16 '18 at 6:28











  • Did you try to add kotlin into your library module?

    – p.alexey
    Nov 16 '18 at 6:41

















  • you want to add library in second project ???

    – Ali
    Nov 16 '18 at 6:06











  • I need library, which will know about main project code

    – Andriy Antonov
    Nov 16 '18 at 6:08











  • Can you post your build.gradle file?

    – p.alexey
    Nov 16 '18 at 6:25











  • @p.alexey please, take a look. I update my question with gradle files

    – Andriy Antonov
    Nov 16 '18 at 6:28











  • Did you try to add kotlin into your library module?

    – p.alexey
    Nov 16 '18 at 6:41
















you want to add library in second project ???

– Ali
Nov 16 '18 at 6:06





you want to add library in second project ???

– Ali
Nov 16 '18 at 6:06













I need library, which will know about main project code

– Andriy Antonov
Nov 16 '18 at 6:08





I need library, which will know about main project code

– Andriy Antonov
Nov 16 '18 at 6:08













Can you post your build.gradle file?

– p.alexey
Nov 16 '18 at 6:25





Can you post your build.gradle file?

– p.alexey
Nov 16 '18 at 6:25













@p.alexey please, take a look. I update my question with gradle files

– Andriy Antonov
Nov 16 '18 at 6:28





@p.alexey please, take a look. I update my question with gradle files

– Andriy Antonov
Nov 16 '18 at 6:28













Did you try to add kotlin into your library module?

– p.alexey
Nov 16 '18 at 6:41





Did you try to add kotlin into your library module?

– p.alexey
Nov 16 '18 at 6:41












0






active

oldest

votes











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%2f53332289%2fimplementation-project-app-in-libmodule-not-working%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















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%2f53332289%2fimplementation-project-app-in-libmodule-not-working%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

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線