{"id":21083885,"url":"https://github.com/spongebobsun/newndktest","last_synced_at":"2025-06-17T13:33:27.053Z","repository":{"id":84564570,"uuid":"41352115","full_name":"SpongeBobSun/NewNDKTest","owner":"SpongeBobSun","description":"NDK Project Template using Android Studio v1.3 \u0026 Gradle 2.5 \u0026 Experimental android plugin","archived":false,"fork":false,"pushed_at":"2015-08-26T03:08:38.000Z","size":208,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-14T05:11:15.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SpongeBobSun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-25T08:17:18.000Z","updated_at":"2016-05-19T16:54:26.000Z","dependencies_parsed_at":"2023-03-12T23:38:25.497Z","dependency_job_id":null,"html_url":"https://github.com/SpongeBobSun/NewNDKTest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SpongeBobSun/NewNDKTest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FNewNDKTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FNewNDKTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FNewNDKTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FNewNDKTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SpongeBobSun","download_url":"https://codeload.github.com/SpongeBobSun/NewNDKTest/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SpongeBobSun%2FNewNDKTest/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260369760,"owners_count":22998694,"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":[],"created_at":"2024-11-19T20:20:30.061Z","updated_at":"2025-06-17T13:33:22.039Z","avatar_url":"https://github.com/SpongeBobSun.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"#NewNDKTest\nNDK project template using Android Studio v1.3 \u0026 Gradle 2.5 \u0026 Experimental android plugin.\n##Introduction\nDue to android plugin has been updated, the gradle script need to be modified to add NDK support.\n\n** This project is inspried by this post [NDK Developing Using Android Studio v1.3 (Chinese)](http://blog.csdn.net/g707175425/article/details/47154115) **\n\n\nI have to say this new gradle script is better than the old one, but it's a pain in the arse to porting old projects to new one.\n\nI hope this sample will give you a quick jump start on your NDK projects.\n\n##Project Structure\nThis project is a test project.\n\nOnly thing it does is display a string returned from native code.\n\n#####But, it contains new gradle script and project configs. \n#####Consider this is a backup \u0026 reference for my own.\n\n##Gradle Part\nFollow below instructions to modify your scripts.\n\n1. Change your gradle to v2.5 if you are using an older version. (You may need to modify your `gradle-wrapper.properties` file)\n\n2. Using experimental android plugin by changing `build.gradle` in your project ** root ** folder.\n\t\n\t\tbuildscript {\n    \t\trepositories {\n    \t    \tjcenter()\n    \t\t}\n    \t\tdependencies {\n\t\t\t\tclasspath 'com.android.tools.build:gradle-experimental:0.1.0'\n    \t\t}\n\t\t}\n\n\t\tallprojects {\n    \t\trepositories {\n        \t\tjcenter()\n    \t\t}\n\t\t}\n\t\t\n3. Change `build.gradle` in your app module.\n\t* Using 'com.android.model.application' plugin instead of the old one by changing the first line of this file.\n\t\n\t\t\tapply plugin: 'com.android.model.application'\n\t\t\t\n\t* Using equation (`a = b`) when passing value to variables\n\t\t\t\n\t* In the new script grammar, `android` module is located in `model` section. So wrap your `android` module with a `model` module.\n\t\n\t\t\tapply plugin: 'com.android.model.application'\n\t\t\tmodel {\n    \t\t\tandroid {\n        \t\t\tcompileSdkVersion = 22\n        \t\t\tbuildToolsVersion = \"22.0.1\"\n\n        \t\tdefaultConfig.with {\n            \t\tapplicationId = \"sun.bob.newndktest\"\n            \t\tminSdkVersion.apiLevel = 8\n            \t\ttargetSdkVersion.apiLevel = 23\n            \t\tversionCode = 1\n            \t\tversionName = \"1.0\"\n        \t\t}\n        \t\ttasks.withType(JavaCompile) {\n            \t\tsourceCompatibility = JavaVersion.VERSION_1_7\n            \t\ttargetCompatibility = JavaVersion.VERSION_1_7\n        \t\t}\n    \t\t}\n\t* As for the `buildType`, `sources`, `productFlavors` and other gradle modules, they are moved to outside of 'android' module but with an 'android' prefix.\n\n\t\t\tapply plugin: 'com.android.model.application'\n\t\t\tmodel {\n    \t\t\tandroid {\n        \t\t\t....\n        \t\t}\n    \t\t}\n\t\t\tandroid.buildTypes {\n\t            release {\n\t                isMinifyEnabled = false\n\t                proguardFiles += file('proguard-rules.pro')\n\t            }\n\t        }\n\t        android.sources {\n\t            main{\n\t                java {\n\t                    source{\n\t                        srcDir 'src'\n\t                    }\n\t                }\n\t            }\n\t        }\n\t        android.ndk {\n\t            moduleName=\"JNITest\"\n\t            ldLibs += 'log'\n\t            ldLibs += 'z'\n\t            ldLibs += 'm'\n\t            abiFilters += \"armeabi\"\n\t            abiFilters += \"armeabi-v7a\"\n\t            abiFilters += \"x86\"\n\t        }\n\t        \n##Java Part\n* Add an jni folder to your project by - \n\n\t\tRight click your src/main folder and choose 'New' =\u003e 'Folder(with an droid icon)' =\u003e 'JNI Folder'.\n\t\t\n* Create a java class in your package (NOT THE JNI FOLDER WE JUST CREATED!) and declare some native method in it.\n* Use `javah` to generate header.\n* Implement native method.\n* Build, Run, Have fun.\n\t        ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspongebobsun%2Fnewndktest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspongebobsun%2Fnewndktest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspongebobsun%2Fnewndktest/lists"}