{"action":"created","issue":{"url":"https://api.github.com/repos/MobiVM/robovm/issues/264","repository_url":"https://api.github.com/repos/MobiVM/robovm","labels_url":"https://api.github.com/repos/MobiVM/robovm/issues/264/labels{/name}","comments_url":"https://api.github.com/repos/MobiVM/robovm/issues/264/comments","events_url":"https://api.github.com/repos/MobiVM/robovm/issues/264/events","html_url":"https://github.com/MobiVM/robovm/issues/264","id":296052953,"number":264,"title":"Kotlin classes in library module not being compiled","user":{"login":"clydebarrow","id":2366188,"avatar_url":"https://avatars0.githubusercontent.com/u/2366188?v=4","gravatar_id":"","url":"https://api.github.com/users/clydebarrow","html_url":"https://github.com/clydebarrow","followers_url":"https://api.github.com/users/clydebarrow/followers","following_url":"https://api.github.com/users/clydebarrow/following{/other_user}","gists_url":"https://api.github.com/users/clydebarrow/gists{/gist_id}","starred_url":"https://api.github.com/users/clydebarrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clydebarrow/subscriptions","organizations_url":"https://api.github.com/users/clydebarrow/orgs","repos_url":"https://api.github.com/users/clydebarrow/repos","events_url":"https://api.github.com/users/clydebarrow/events{/privacy}","received_events_url":"https://api.github.com/users/clydebarrow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-10T00:20:35Z","updated_at":"2018-02-10T11:07:06Z","closed_at":null,"author_association":"NONE","body":"Please ensure you have given all the following requested information in your report.\r\n\r\n#### Issue details\r\nI have a project with mostly Java source, but some Kotlin sources. Kotlin source files in the app module itself appear to work ok, but if I have Kotlin sources in a library module, they are not compiled when the app is built through Android Studio, but are compiled if I use gradlew from the command line to build and launch the app. The symptom is that at run time the app fails with \"ClassNotFoundException\" when trying to load a class generated from the Kotlin source.\r\n\r\nExamining the log of the build process shows that when built from the command line, the Kotlin class files in question _are_ compiled by Robovm, but _not_ when built from AS.\r\n\r\nIf the generated class files are copied from the folder .../build/classes/kotlin/main/... to .../build/classes/java/main/... in the library module and the compilation re-run, then compiling with AS does show those classes as being compiled, and the app works.\r\n\r\nSo it appears that the compilation process performed by the AS Robovm plugin is not scanning the build/classes/kotlin folder in a library module (though it does in the app module.)\r\n\r\n\r\n#### Reproduction steps/code\r\nCreate an iOS project with an app module, and a library module. Create a Kotlin source file in the library module and use it in the app. Run the app from Android Studio (simulator or device)\r\n#### Configuration\r\nAndroid Studio 2.0.1 on MacOS 10.13.1.\r\n**Build Tools:**\r\n- [ ] IDEA plugin - 2.3.3 or 2.3.4-SNAPSHOT\r\n- [ ] Eclipse plugin\r\n- [ ] Gradle plugin - 2.3.3 or 2.3.4-SNAPSHOT\r\n \r\n**Versions:**\r\n\r\n_Please provide the version of RoboVM, XCode and JDK used_\r\n- Robovm: 2.3.3 or 2.3.4-SNAPSHOT\r\n- XCode: 9.2\r\n- JDK: 1.8\r\n\r\n**Build Targets:**\r\n\r\nIPadSimulator (x86_64) and iPad (32 bit)\r\n\r\n---\r\n\r\n#### Stacktrace\r\n```java\r\n\r\njava.lang.NoClassDefFoundError:\r\ncom/controlj/ios/framework/FoundationLogger \tat \r\ncom.controlj.ios.framework.IosApp.didFinishLaunching(IosApp.java:48) \tat \r\ncom.controlj.ios.bluemax.BlueMAXiOSApp.didFinishLaunching(BlueMAXiOSApp.java:35) \tat \r\ncom.controlj.ios.framework.IosApp.$cb$application$didFinishLaunchingWithOptions$(IosApp.java) \tat \r\norg.robovm.apple.uikit.UIApplication.main(Native Method) \tat \r\norg.robovm.apple.uikit.UIApplication.main(UIApplication.java:428) \tat \r\ncom.controlj.ios.bluemax.BlueMAXiOSApp.main(BlueMAXiOSApp.java:78)\r\n--\r\n\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/MobiVM/robovm/issues/comments/364643924","html_url":"https://github.com/MobiVM/robovm/issues/264#issuecomment-364643924","issue_url":"https://api.github.com/repos/MobiVM/robovm/issues/264","id":364643924,"user":{"login":"clydebarrow","id":2366188,"avatar_url":"https://avatars0.githubusercontent.com/u/2366188?v=4","gravatar_id":"","url":"https://api.github.com/users/clydebarrow","html_url":"https://github.com/clydebarrow","followers_url":"https://api.github.com/users/clydebarrow/followers","following_url":"https://api.github.com/users/clydebarrow/following{/other_user}","gists_url":"https://api.github.com/users/clydebarrow/gists{/gist_id}","starred_url":"https://api.github.com/users/clydebarrow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clydebarrow/subscriptions","organizations_url":"https://api.github.com/users/clydebarrow/orgs","repos_url":"https://api.github.com/users/clydebarrow/repos","events_url":"https://api.github.com/users/clydebarrow/events{/privacy}","received_events_url":"https://api.github.com/users/clydebarrow/received_events","type":"User","site_admin":false},"created_at":"2018-02-10T11:07:06Z","updated_at":"2018-02-10T11:07:06Z","author_association":"NONE","body":"I have worked around this issue by adding Before Launch items to the Run configuration:\r\n````\r\nRun Gradle task 'iosApp:compileJava'\r\nRun Gradle task 'iosApp:compileKotlin'\r\nExternal tool 'External Tools/CopyKotlin'\r\nBuild\r\n````\r\nWhere the CopyKotlin task is a shell script that copies all the class files in the ...classes/kotlin/... folder to the corresponding location in the ...classes/java/... folder.\r\n\r\n````\r\ncp -r ../../applibs/common/build/classes/kotlin/ ../../applibs/common/build/classes/java/\r\ncp -r ../../applibs/ios/build/classes/kotlin/ ../../applibs/ios/build/classes/java/\r\n````\r\nThis works - and including the compile tasks solves the other problem I've had where the Robovm plugin did not recompile Java files before running, leading to much tearing out of hair when changes had no effect :-)\r\n\r\n"}}
{"actor":{"display_login":"clydebarrow"}}