android ndk(一) hello-jni

來源:互聯網
上載者:User

1.下載ndk-r7b,因為r7以及之後的版本繼承了cygwin,(make gcc), 所以下載解壓後就算環境配置好了,最好也下個CDT重啟安裝,以方便在Eclipse裡對c代碼的編寫

2.入門 匯入hello-jni , 本人很懶就直接複製官網的了,相信都看的懂

Click File > New Android Project...

Select the Create project from existing source radio button.

Select any API level above Android 1.5.

In the Location field, click Browse... and select the <ndk-root>/samples/hello-jni directory.

Click Finish.  

3.編譯builder

官網提供的文檔沒看懂,這裡用其他的方法

 (1)項目上點右鍵properties->builders->new  Locatioin
配置ndk-build.cmd的路徑,Working Directory選擇要編譯的項目

(2)打鉤refresh的refresh resources upon completion


(3)打鉤build
options 的During auto builds 和specify working set of relevant resources


(4)點擊specify
resources打鉤jni檔案夾.這樣勾是告訴builder,只編譯這個檔案夾的檔案即可.整個項目編譯的話,電腦會嚎叫的


(5)控制台列印資訊,項目裡有了libs/armeabi/libhello-jni.so和obj檔案夾


4.運行程式,顯示出了結果,你可以喝點銀鷺慶賀哦


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.