I want to create a class diagram from all the Kotlin packages in Android Studio. Since the code structure is more on the complex side, I'd like a way to automatically generate said diagram. I tried researching and installing some plugins inside of Android Studio but none have worked so far. Most of them seem to be made for IntelliJ and primarily Java, perhaps that's why it's not working. Can you recommend something that would help me generate a Kotlin Class Diagram? Below is an example of the format I'd excpect. Thank you in advance!
Example of a preferred class diagram
Related
I want to generate a class diagram from my existing codes in my Android Studio project. Is there a way to do this?
I have seen some questions on this but they are about 5+ years old. I am looking for a more updated answer if possible.
It's not possible in Android Studio.
However, you can use Intellij Idea Ultimate to generate the class diagram.
https://www.jetbrains.com/help/idea/class-diagram.html
I'm trying to understand what structure should have a multiplatform library. Checking on the Internet I've seen a huge number of examples explaining how to make a log or a "hello world" but there's a lack of complex examples, even in the official documentation (important to note that I'm only interested in mobile platform, iOS and Android).
So I want to create an example that simply opens the camera (as a lib, not as a multiplatform app) just to have an idea of how to work with a real feature which, also, is native. Right now I have created a project following the official example, so it has a common module (using expect) and one for Android and one for iOS (using actual), and now these are my doubts:
I've seen that the iOS module is also in Kotlin, Kotlin/Native as I understand. Should my project have also an wrapper in Swift, or will the library have no Swift code? And if it should, where should it be in the project structure?
Also in the Android module I've noticed I cannot import the class "Activity" nor the "Intent", which I will need to open the camera, why? is this code restricted to Java without the Android libs? Should it also have a wrapper to Android? If so, how can I configure this wrappers?
I know I can use the "expect" key when creating classes but, as I understand, the common and the native modules will always be separated classes. I mean, if I create a class in the common module, can I define methods of this class using "expect" and define them later in the native?
Can my lib have a Manifest?
Finally, does anyone knows a real example that really explain a more complex situation?
Thanks
Okay, let's go through your questions one-by-one.
I would recommend you to have a look at this example
The
iOS module produces an Objective-C framework as a result. It can be utilized by the Xcode project the same way as any other framework with non-Kotlin origins.
It looks like the unavailability to use
Android SDK is the result of using jvm("android") target instead
of android() one. To use the android target, one has to apply the android Gradle plugin in addition to kotlin-multiplatform one.
I
think you want to do something like that: just ordinary class
declaration in the common and extension function for it with an
expect modifier. And then actualize it in the platform-specific
code.
I think so.
I'd also recommend you to have a look at
this and this, maybe these examples will be complex enough for you.😁
I am developing an AR app. I am developing all the UI and menus in android studio and a scene in unity. I am trying to pass a string from my android studio project to my unity scene. Is there a built-in way to do this? I am trying to implement it with writing to files but it doesn't seem like a good way to do it.
Thank You in advance.
You can achieve this in many different ways:
Display your mUnityPlayer within a Fragment and then handle the scene with the FragmentManager
Extend an Activity from UnityPlayerActivity and communicate as the rest of activities
Use SharedPreferences and its listeners
You can think of many other ways to tackle this issue, hope any of them give you a hint
Get classes.jar from one of the sub-folders from
<UnityInstallationDirectory>\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\mono
or
<UnityInstallationDirectory>\Editor\Data\PlaybackEngines\AndroidPlayer\Variations\il2cpp
depending on if you are using mono or IL2CPP as Scripting Backend to build your Android Project.
Once you import the classes.jar module into your Android Java project, you can the use UnityPlayer.UnitySendMessage to call C# function from Java.
UnityPlayer.UnitySendMessage("Gameobject Name","Method","Message")
If you plan to extend UnityPlayerActivity then grab UnityPlayerActivity.java from
<UnityInstallationDirectory>\Editor\Data\PlaybackEngines\AndroidPlayer\Source\com\unity3d\player.
Finally, UnityPlayer.UnitySendMessage is what you are looking for. There are many tutorials out there on how to use it, if you are still confused.
I apologies for my ignorance. Lately I have been working on Android framework. The developer said it is fastest framework built to the date because it does not uses reflection and generates code while building apps. I just want to know how these frameworks generate code and how they include this code in class path. What's there approach ? I want a general concept because I have few ideas and I want to implement them like this.
I want to write an ORM for Android as my final project.
My first idea is to inject code for each get and set.
Unfortunately I found a lot of posts saying there is no way to inject code in Android.
On the other hand I found "Dexmaker" to generate code on runtime.
My question is: Is it possible to somehow inject code in Android (by "Dexmaker" or anything else)?
If not how to do it ?
I also thought about reflections but I am afraid that it will be to slow.
Thanks in advance.
Edit
Simon:
Yes by ORM I ment object relational mapping.
I want to create a general framework. How else I could do this than not by code injection ?
You can inject code using Dexmaker. The project site has a HelloWorldMaker example that generates a class and then loads it.
You may find the performance of runtime code generation to be unsatisfying however. Projects like Dagger have had better success metaprogramming with code generation.