Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project structure lost due to spurious dependency problem #88

Open
TimLavers opened this issue Jan 11, 2018 · 5 comments
Open

Project structure lost due to spurious dependency problem #88

TimLavers opened this issue Jan 11, 2018 · 5 comments

Comments

@TimLavers
Copy link

I've got these dependencies in my build file:

object Versions {
val kotlin = "1.2.10"
val kotlintest = "2.0.7"
val junit = "4.12"
val derby = "10.13.1.1"
val hibernate = "5.2.11.Final"
val ktor = "0.9.0"
}

dependencies {
    compile("org.jetbrains.kotlin:kotlin-runtime:${Versions.kotlin}")
    compile("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
    compile("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}")
    compile("io.ktor:ktor-server-netty:${Versions.ktor}")
    compile("io.ktor:ktor:${Versions.ktor}")
    compile("io.ktor:ktor-gson:${Versions.ktor}")
}

dependenciesTest {
    compile("junit:junit:${Versions.junit}")
    compile("io.kotlintest:kotlintest:${Versions.kotlintest}")
    compile("io.ktor:ktor-server-test-host:${Versions.ktor}")
}

Building from the command line (kobaltw assemble) works fine.

However, when I refresh the project in the Kobalt plugin, the project structure is lost.

The IntelliJ log file includes this message:
2018-01-12 07:10:11,118 [484014126] WARN - ution.rmi.RemoteProcessSupport - WARN: Received error message from Kobalt server: Could not find artifact org.jetbrains.kotlin:kotlin-stdlib:jar:1.1.60-eap-43 in Maven (http://repo1.maven.org/maven2/)

It's not clear why that dependency is required.

The log then continues with:
2018-01-12 07:10:11,162 [484014170] INFO - pl.ProjectRootManagerComponent - project roots have changed
2018-01-12 07:10:11,207 [484014215] INFO - .diagnostic.PerformanceWatcher - Pushing properties took 0ms; general responsiveness: ok; EDT responsiveness: ok
2018-01-12 07:10:11,208 [484014216] INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 1ms; general responsiveness: ok; EDT responsiveness: ok
2018-01-12 07:10:11,343 [484014351] ERROR - j.psi.stubs.StubTreeLoaderImpl - Outdated stub in index: file://C:/Code3/xxxxx/kobalt/src/Build.kt indexed at 1515701228729 with document size 3159, doc=DocumentImpl[file://C:/Code3/xxxxx/kobalt/src/Build.kt], docSaved=true, wasIndexedAlready=true, queried at 1515701231946
indexed lengths={chars=3248, bytes=3349}
doc length=3159
file length=3258
cached PSI class org.jetbrains.kotlin.psi.KtFile
projects with file: 2
java.lang.Exception
at com.intellij.psi.stubs.StubTreeLoaderImpl.a(StubTreeLoaderImpl.java:175)
at com.intellij.psi.stubs.StubTreeLoaderImpl.a(StubTreeLoaderImpl.java:145)
at com.intellij.psi.stubs.StubTreeLoaderImpl.readFromVFile(StubTreeLoaderImpl.java:113)
at com.intellij.psi.stubs.StubTreeLoaderImpl.readOrBuild(StubTreeLoaderImpl.java:53)
at com.intellij.psi.impl.source.PsiFileImpl.getStubTree(PsiFileImpl.java:651)
at com.intellij.psi.impl.source.PsiFileImpl.getStub(PsiFileImpl.java:614)
at org.jetbrains.kotlin.psi.KtFile.getStub(KtFile.kt:166)
at org.jetbrains.kotlin.psi.KtFile.isScript(KtFile.kt:188)
at org.jetbrains.kotlin.idea.highlighter.KotlinHighlightingUtil.shouldHighlightErrors(KotlinHighlightingUtil.kt:36)

If I then change the dependencies to:

object Versions {
val kotlin = "1.2.10"
val kotlintest = "2.0.7"
val junit = "4.12"
val derby = "10.13.1.1"
val hibernate = "5.2.11.Final"
val ktor = "0.9.1-alpha-8"
}
dependencies {
compile("org.jetbrains.kotlin:kotlin-runtime:${Versions.kotlin}")
compile("org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlin}")
compile("org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin}")
compile("io.ktor:ktor-server-netty:${Versions.ktor}")
compile("io.ktor:ktor:${Versions.ktor}")
compile("io.ktor:ktor-gson:${Versions.ktor}")
}

dependenciesTest {
compile("junit:junit:${Versions.junit}")
compile("io.kotlintest:kotlintest:${Versions.kotlintest}")
// compile("io.ktor:ktor-server-test-host:${Versions.ktor}")
}
Then the project structure is restored.

However, the original set of dependencies should work fine as they are fine from the command line and they are copied from some gradle projects that work fine.

@dmitry-zhuravlev
Copy link
Collaborator

Hm, weird... Could you please share an example project to fast reproduce this problem?

@TimLavers
Copy link
Author

TimLavers commented Jan 12, 2018

Build file attached (could only add as zip). It has four projects. The last one is the issue - see the comment at the end.

Build.zip

@barotashish
Copy link

Hi Team,

when I am starting new project in my Android studio, I am getting following error :-

Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0.
Open File
Show Details

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve com.android.support.constraint:constraint-layout:1.1.0.
Open File
Show Details

=== My testing environment details :-

OS :- Ubuntu Linux, 18.04 - ( Just upgraded Ubuntu linux from 17.10 )

Android Studio version :- 3.1.2 ( Linux Platform )

@barotashish
Copy link

Now also getting IDE Fatal error

screenshot from 2018-05-16 16-01-12

@Keesdil
Copy link

Keesdil commented Dec 13, 2018

barotashish : The IDE Fatal error with "java.lang.exception etcetera" looks like the strange things i have got with my project in Android Studio.
Several java files that i made were named in the log file, each one starting with "Outdated stub in index: file:" and then the absolute path of the file. In the editor those files were completely corrupted with log information, resulting in numerous compiler errors. Odd thing : in explorer those files were not showing wrong content!
Did anone notice problems like this and / or know a solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants