jarroyoesp / kotlinmultiplatform Goto Github PK
View Code? Open in Web Editor NEWKotlin MultiPlatform App (Android, iOS, JVM & JS). MVVM/MVP - Kotlin MultiPlatform
License: GNU General Public License v3.0
Kotlin MultiPlatform App (Android, iOS, JVM & JS). MVVM/MVP - Kotlin MultiPlatform
License: GNU General Public License v3.0
I am using a MacOS Catalina
./gradlew JavaFxApp:run
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :app
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
'kapt.generateStubs' is not used by the 'kotlin-kapt' plugin
> Configure project :SharedCode
Kotlin Multiplatform Projects are an experimental feature.
> Task :SharedCode:compileKotlinJvm
w: //PathToProject/SharedCode/src/commonMain/kotlin/com/jarroyo/sharedcode/source/network/WeatherApi.kt: (21, 18): This declaration is experimental and its usage should be marked with '@kotlinx.serialization.UnstableDefault' or '@UseExperimental(kotlinx.serialization.UnstableDefault::class)'
w: //PathToProject/SharedCode/src/commonMain/kotlin/com/jarroyo/sharedcode/source/network/WeatherApi.kt: (33, 39): This declaration is experimental and its usage should be marked with '@kotlinx.serialization.UnstableDefault' or '@UseExperimental(kotlinx.serialization.UnstableDefault::class)'
w: //PathToProject/SharedCode/src/commonMain/kotlin/com/jarroyo/sharedcode/source/repository/LocationRepository.kt: (57, 70): Parameter 'failure' is never used
> Task :JavaFxApp:compileKotlin
w: //PathToProject/JavaFxApp/src/main/java/com/jarroyo/sharedcode/AppController.kt: (135, 21): Variable 'cityName' is never used
w: //PathToProject/JavaFxApp/src/main/java/com/jarroyo/sharedcode/AppController.kt: (135, 50): Unnecessary safe call on a non-null receiver of type kotlin.collections.ArrayList<Location> /* = java.util.ArrayList<Location> */
> Task :JavaFxApp:run FAILED
Exception in Application start method
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$154(LauncherImpl.java:182)
at java.lang.Thread.run(Thread.java:748)
Caused by: javafx.fxml.LoadException:
//PathToProject/JavaFxApp/build/resources/main/app.fxml
at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2571)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
at com.jarroyo.sharedcode.JavaFxAppKt.launchApp(JavaFxApp.kt:9)
at com.jarroyo.sharedcode.Main.start(Main.kt:11)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2566)
... 15 more
Caused by: java.sql.SQLException: path to '/Users/javierarroyo/Projects/Pruebas/KotlinMultiplatform/First/JavaFxApp/database/database.db': '/Users/javierarroyo' does not exist
at org.sqlite.core.CoreConnection.open(CoreConnection.java:192)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:76)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:25)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:24)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:45)
at org.sqlite.JDBC.createConnection(JDBC.java:114)
at org.sqlite.JDBC.connect(JDBC.java:88)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
at com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver.<init>(JdbcSqliteDriver.kt:29)
at com.squareup.sqldelight.sqlite.driver.JdbcSqliteDriver.<init>(JdbcSqliteDriver.kt:20)
at com.jarroyo.sharedcode.source.disk.SQLDriverKt.getSqlDriver(SQLDriver.kt:15)
at com.jarroyo.sharedcode.source.disk.DatabaseCreator.getDataBase(SQLDriver.kt:12)
at com.jarroyo.sharedcode.repository.LocationRepository.<init>(LocationRepository.kt:19)
at com.jarroyo.sharedcode.di.InjectorCommon$locationRepository$2.invoke(InjectionsCommon.kt:43)
at com.jarroyo.sharedcode.di.InjectorCommon$locationRepository$2.invoke(InjectionsCommon.kt:17)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.jarroyo.sharedcode.di.InjectorCommon.getLocationRepository(InjectionsCommon.kt)
at com.jarroyo.sharedcode.di.InjectorCommon.provideGetLocationMPPUseCase(InjectionsCommon.kt:48)
at com.jarroyo.sharedcode.di.InjectorCommon.provideProfilePresenter(InjectionsCommon.kt:65)
at com.jarroyo.sharedcode.AppController.initPresenter(AppController.kt:75)
at com.jarroyo.sharedcode.AppController.initialize(AppController.kt:34)
... 25 more
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':JavaFxApp:run'.
> Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 27s
6 actionable tasks: 6 executed
First of all, a big thanks! I had all the problem in the world to have my setting complete with the iOS portion. My Android app is running fine wit the shared code but noting worked with iOS. I did checked how you configured everything and use the same approach and now everything seems to be working fine.
Now, I have a question related to the bundling of Kotlin code into the iOS framework. I thought the iOS project had to import the .framework
to be able to use the code. Now after building and using the packForXcode
task in a script phase, the code is just magically there to be imported. Do you know what is going on exactly?
Thanks!
In the build JS there's
///...
var package$feature = package$com.feature || (package$com.feature = {});
package$feature.main_kand9s$ = main;
package$feature.Platform = Platform;
main([]);
}));
You can see it calls main([]);
I don't understand why is that, since regardless if you call like like so
node test.js foo bar
or like so
./test.js foo bar
It's argument structure is always the same:
$ ./test.js foo bar
[ '/Users/danon/.nvm/versions/node/v10.17.0/bin/node',
'/Users/danon/Projects/test.js',
'foo',
'bar' ]
Why couldn't kotlin compile it to JS
main(process.argv.slice(2));
JVM compiled version with the same Kotlin code does handle starting arguments.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.