{"id":20592127,"url":"https://github.com/bennyhuo/hello-kni","last_synced_at":"2025-04-14T22:54:28.118Z","repository":{"id":48997627,"uuid":"119306507","full_name":"bennyhuo/hello-kni","owner":"bennyhuo","description":"Demo for Jni call Kotlin-Native lib.","archived":false,"fork":false,"pushed_at":"2022-12-07T18:06:42.000Z","size":202,"stargazers_count":96,"open_issues_count":1,"forks_count":19,"subscribers_count":5,"default_branch":"mpp-gradle","last_synced_at":"2025-04-14T22:54:12.792Z","etag":null,"topics":["android","jni-android","kotlin","kotlin-native"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bennyhuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-28T23:10:25.000Z","updated_at":"2025-01-27T07:49:47.000Z","dependencies_parsed_at":"2023-01-24T17:30:15.372Z","dependency_job_id":null,"html_url":"https://github.com/bennyhuo/hello-kni","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyhuo%2Fhello-kni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyhuo%2Fhello-kni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyhuo%2Fhello-kni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bennyhuo%2Fhello-kni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bennyhuo","download_url":"https://codeload.github.com/bennyhuo/hello-kni/tar.gz/refs/heads/mpp-gradle","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975330,"owners_count":21192208,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","jni-android","kotlin","kotlin-native"],"created_at":"2024-11-16T07:42:49.201Z","updated_at":"2025-04-14T22:54:28.082Z","avatar_url":"https://github.com/bennyhuo.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"Hello KNI\n=========\n\nThis is a Demo of Jni calling Kotlin Native originated from Google's jni demo.\n\n### Contents\n\nKotlin Native can interop with C directly. In order to call Kotlin Native functions from Java, we should use `CName` to annotated the functions with a proper name:\n\n```kotlin\n@CName(\"Java_com_example_hellojni_HelloJni_stringFromJNI\")\nfun stringFromJNI(env: CPointer\u003cJNIEnvVar\u003e, thiz: jobject): jstring {\n    memScoped {\n        return env.pointed.pointed!!.NewStringUTF!!.invoke(env, \"This is from Kotlin Native!!\".cstr.ptr)!!\n    }\n}\n```\n\nWhat's in the demo：\n\n* Uses of Android Log\n* Return a Java String\n* Call Java methods from Kotlin Native\n\n### How to Build\n\n\nSimply Build and run your app. Dependencies are carefully managed by gradle.\n\n### Preview\n\nScreen shot:\n\n![](images/screen-shot.png)\n\nLogcat :\n\n![](images/log.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennyhuo%2Fhello-kni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbennyhuo%2Fhello-kni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbennyhuo%2Fhello-kni/lists"}