Skip to content
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

Can't build the desktop app #5

Open
landoulsi opened this issue Feb 6, 2020 · 1 comment
Open

Can't build the desktop app #5

landoulsi opened this issue Feb 6, 2020 · 1 comment

Comments

@landoulsi
Copy link

landoulsi commented Feb 6, 2020

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
@landoulsi landoulsi changed the title Can build the desktop app Feb 6, 2020
@jarroyoesp
Copy link
Owner

Hi @landoulsi, thank you for your comment.
Yes, the problem is that you are not setting the path to save your database file. In the code, I set the path to my computer. You have to change this path as you can read on the Readme:

If you want to persist your database in your disk, you have to indicate the path when you create the database driver:

SQLDriver.kt
JdbcSqliteDriver("jdbc:sqlite:$your_database_path")

I hope it helps you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants