{"id":21358111,"url":"https://github.com/raycad/hello-gdbserver","last_synced_at":"2025-09-03T01:33:30.701Z","repository":{"id":33530597,"uuid":"37176682","full_name":"raycad/hello-gdbserver","owner":"raycad","description":"Instruct how to debug native code in Android project","archived":false,"fork":false,"pushed_at":"2015-06-10T05:09:50.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T18:32:32.713Z","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/raycad.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-06-10T05:07:46.000Z","updated_at":"2015-06-10T05:09:50.000Z","dependencies_parsed_at":"2022-09-06T23:30:41.562Z","dependency_job_id":null,"html_url":"https://github.com/raycad/hello-gdbserver","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/raycad%2Fhello-gdbserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raycad%2Fhello-gdbserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raycad%2Fhello-gdbserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raycad%2Fhello-gdbserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raycad","download_url":"https://codeload.github.com/raycad/hello-gdbserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830956,"owners_count":20354856,"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-22T05:14:25.072Z","updated_at":"2025-03-16T06:16:21.292Z","avatar_url":"https://github.com/raycad.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Debug native code in Android project with NDK in Eclipse\n\n1. Install CDT from Eclipse update site.\n\tHelp -\u003e Install New Software -\u003e Select Eclipse update -\u003e Programming Language -\u003e C/C++ Development Tools -\u003e Next ... -\u003e Finish\n\t\n2. Download and extract Android NDK.\n\thttps://developer.android.com/tools/sdk/ndk/index.html\n\t\t\n3. Import your C/C++ source code to Eclipse.\n\n4. Set Android NDK path.\n\tWindow -\u003e Preferences -\u003e Android -\u003e NDK  -\u003e Set path to the NDK\n\t\n5. Right click on an Android project and select Android Tools -\u003e Add native support.\n\tNote that you will not be able to add native support if the project already has C/C++ nature.\n\n6. Right click project -\u003e Properties -\u003e C/C++ Build then add the following line to the \"Build command\": \n\tndk-build NDK_DEBUG=1\n\t\n7. Add more line to application tag of the AndroidManifest.xml file:\n\tandroid:debuggable=\"true\"\n\t\t\n8. Set breakpoint in your C/C++ code.\n\n9. Right click on your project, select Debug As -\u003e Android Native Application. \n\nKNOWN ISSUES:\n- Error when debugging: Unable to detect application ABI's\nTo fix this, add more information to your Android.mk file, e.g:\n\tAPP_ABI := armeabi\n\tAPP_PLATFORM := android-15\n\n- It is recommended to introduce delay (about 5 seconds) in the application code between loading the native code library and calling any native functions (to be debugged), e.g:\n\ntry {\n\tSystem.loadLibrary(\"some_native_lib.so\");\n} catch (UnsatisfiedLinkError e) {\n\treturn -1;\n}\n\n// Wait for GDB init\nif ((getApplicationInfo().flags \u0026 ApplicationInfo.FLAG_DEBUGGABLE) != 0) {\n\ttry {\n\t\tThread.sleep(5000);\n        } catch (InterruptedException e) { }\n}\n\n// Start calling native functions here\n// ...\n\t\n\t\t\n\t","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraycad%2Fhello-gdbserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraycad%2Fhello-gdbserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraycad%2Fhello-gdbserver/lists"}