-
Notifications
You must be signed in to change notification settings - Fork 1
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
How to use kotlin2plantuml.jar with an Android Studio project? #183
Comments
Hi! You're right, the main issue here has to do with the classpath. Right now i can think of two "quick" solutions:
task diagram(type: JavaExec) {
var classpathList = new ArrayList<File>()
classpathList.add("<path-to-build-dir>")
classpathList.add(new File("kotlin2plantuml.jar"))
classpath classpathList.toArray();
mainClass = "io.github.kelvindev15.kotlin2plantuml.MainKt"
args "com.example.android.uamp.media.MusicService"
args "<any-cli-option>"
}
You can then launch the task with: ./gradlew diagram
java -cp kotlin2plantuml.jar:<path-to-build-dir> io.github.kelvindev15.kotlin2plantuml.MainKt com.example.android.uamp.media.MusicService I know, it may not the most beautiful way to deal with it... |
I'm guessing you're missing an import. Try importing import java.io.File; At the top of the build file. |
big thank you for answering on my questions) |
sorry, i solved my problem(just switched from Windows to Linux XDDD)
|
|
In Android Kotlin project, when I try to run It means that it found my MainActivity class, but it can't find all other dependencies (in this case, AppCompatActivity from android core library). I think that the only solution is to include jar for each dependency manually, which makes it not practical. |
Hi there,
I'm trying to get kotlin2plantuml.jar running with this project
https://github.com/android/uamp
What I tried was
java -jar kotlin2plantuml.jar com.example.android.uamp.media.MusicService
in the root of the Android Studio project.
But I only get
Exception in thread "main" java.lang.ClassNotFoundException: Unable to find com.example.android.uamp.media.MusicService at io.github.kelvindev15.kotlin2plantuml.utils.ReflectUtils$Companion.loadClassOrThrow(ReflectUtils.kt:34) at io.github.kelvindev15.kotlin2plantuml.utils.ReflectUtils$Companion.loadClassOrThrow$default(ReflectUtils.kt:31) at io.github.kelvindev15.kotlin2plantuml.MainKt.main(Main.kt:92)
From the README I could see , that I maybe have to pass the CLASSPATH over to the command.
So I tried
java -cp . -jar kotlin2plantuml.jar com.example.android.uamp.media.MusicService
java -cp "C:/uamp_test_uml" -jar kotlin2plantuml.jar com.example.android.uamp.media.MusicService
but unfortunatly this doesn't work and results in the same error
The text was updated successfully, but these errors were encountered: