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
feat: Add Kotlin support (Android 8+) #247
Conversation
Why you don't start moding |
Kotlin might be nub but this is ultra por indeed |
Didn't test the plugins support but it should work as well |
Good One. Can't wait for it to be implemented |
Kotlin Blocks? |
This comment was marked as spam.
This comment was marked as spam.
Oops. Should be fixed now. |
dang kotlin |
|
@MikeAndrson ... thank you for this but kotlin is compiling is being executed before java is compiling so kotlin classes cannot call R class because it is java auto generated class.... I hope you fix this soon bro |
I had fixed that bug in this commit after @PranavPurwar pointed it out, it should work now. |
Ok ... I will try to use my litte knowledge in modding to fix that , could you edit the given apk file you shared??? When you are free , in case I can't do it myself , thanks in advance |
👍 I'll try to update the APK this week |
Hello bro. Did you finish it? |
Why no reply bro :) at least say no , 🤝💚 |
Sorry, haven't been able to look into it due to work/school. Do you want the Kotlin patch on v6.4.0 Beta 6 or v6.4.0 test build 01 ? |
Anything you can.... but it is better if you mod rc mod..., take you time . |
Hi @arab-ware, sorry it took so long but I applied the Kotlin patch on v6.4.0 test build 01. Here you go: https://drive.google.com/file/d/1JRPiUaM8kfX0XQPk_wRUSorBbQR206uT/view?usp=sharing |
|
How about rebasing this branch so it would support Github Actions. |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
…as comment Also removes an unused Gson field. Not changing field names just yet so that there's less to fix when merging PR #247.
app/src/main/java/mod/hey/studios/activity/managers/java/ManageJavaActivity.java
Show resolved
Hide resolved
Update: Managed to merge it while also successfully building an APK. Gotta figure out how to remove the kotlin-stdlib dependency automatically added by the Kotlin Gradle plugin, and also instead use the JARs with the working classes, not the classpath ones. |
I think it should be merged. We will figure out other things later. |
I'm already working on it. |
Turns out that simply copying the Gradle modules to Sketchware Pro is much easier than messing around with converted .class files in JARs, excluding Gradle dependencies, etc. Now working on cleanly separating Kotlin compile support from the minApi 21 flavor. |
These patches were merged in, see 601646a...4b7b979. |
🎉 |
This PR adds full Kotlin support (for Android 8+). Kotlin files can be called from Java and vice versa.
kotlin-stdlib
is added automatically if any Kotlin files are present in the project..kt
files can be added in Java(/Kotlin) Manager, or in the following dirs:All credits go to tyron for porting kotlinc to Android and making this possible 👍
Please take your time to review & test this thoroughly before merging it, as there might be stuff that I've missed (although I did test it and it seems to be working well.)
By the way I've already built an APK with this PR on top of the latest v6.4.0 beta 6 release, here you go if you want to build the newer versions on top of it: here
If not, here are the exact steps to produce the APK above: (I use MT Manager but ApkTool can be used as well)
1- Download https://github.com/MikeAndrson/kotlinc-android and open it in Android Studio, then Generate a Signed APK.
(alternatively you can download https://github.com/tyron12233/CodeAssist/ and copy its
build-logic
&
kotlinc
modules to a new project then generate an APK)ma.kotlinc_standalone
package from the DEX files.2- Download the latest release from https://github.com/Sketchware-Pro/Sketchware-Pro/releases. (beta 6 as of writing this)
3- Delete the
kotlin
package inclasses8.dex
in Sketchware Pro's APK from step 2.4- Copy all JAR resources from the APK in step 1 to Sketchware Pro's APK from step 2. (including
META-INF/
&kotlinManifest.properties
!)5- Copy the extracted DEX files from the APK in step 1 to Sketchware Pro's APK from step 2. (Remember to rename them first,
as to not overwrite any DEX in the target APK)
-> Below steps are usual stuff but adding them for completeness.
6- Build Sketchware Pro from source and copy (& overwrite) the classes below to the Sketchware Pro APK in step 2.
7- Replace "Java" to "Java/Kotlin" & "Import Java files" to "Import Java/Kotlin files" in resources.arsc.
8- Sign the final APK if you haven't already.