Closed omeraydindev closed 1 year ago
Why you don't start moding sketchware pro
agin?
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?
Bro it's very good, the compilation works but when i create an activity with setContentView(R.layout.main), i get error saying unresolved R while compiling kotlin (or something related to it even with it's import) which i think is because the R.java file is not compiled and put in classpath before kotlin compiler is run
Bro it's very good, the compilation works but when i create an activity with setContentView(R.layout.main), i get error saying unresolved R while compiling kotlin (or something related to it even with it's import) which i think is because the R.java file is not compiled and put in classpath before kotlin compiler is run
Oops. Should be fixed now.
dang kotlin
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:/.sketchware/mysc/xxx/app/src/main/java /.sketchware/data/xxx/files/java
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)
- Extract DEX files from the APK, delete
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.
DesignActivity, Dp, ExportProjectActivity, ManageJavaActivity, SrcCodeEditor, yq, KotlinCompilerUtil, KotlinDescription, DiagnosticKt, DiagnosticCollectorKt, KotlinCompilerKt.
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.
@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
@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.
@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
@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
@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?
@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 , π€π
@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 ?
@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 .
@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
@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
thank you as the number of your blood cells
How about rebasing this branch so it would support Github Actions.
I do not know if I will support kotlin in the official versions
Jbk plz add kotlin
Can't get this to compile in debug mode. Creating a release APK works.
I really wonder why that happens, and also, why when compiling Kotlin code?
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.
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.
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 601646a309723ea166fa97c24a89aab50535a22f...4b7b979b1b38adee4e14ec2feea1b8b8b4310ce2.
π
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.