Want to compile native Android binary I can run in terminal on the phone

前端 未结 4 1511
粉色の甜心
粉色の甜心 2020-11-29 17:55

I\'ve been trying for a couple days to compile a native ARM Android binary that will execute on my phone using a terminal application. I want to generate the same type of bi

4条回答
  •  借酒劲吻你
    2020-11-29 18:20

    Using CMake with the Android NDK is a nice way to compile Android console applications.

    Download CMake and android-cmake (set it up like this). If your program is called main.c, then write the following in file CMakeLists.txt:

    project(test)
    cmake_minimum_required(VERSION 2.8)
    add_executable(test ./main.c)
    

    and run cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN .

    You will then have a Makefile for your program, you can run make to have your test executable.

提交回复
热议问题