Android adb debug

{

  adb devices

  /*

  List of devices attached
  f5231c96        device

  */

  adb -s f5231c96 shell

  /*

  shell@PD1510:/ $

  */

  //执行部分linux命令

}

{

android.mk

LOCAL_PATH := $(call my-dir)


#include $(CLEAR_VARS)
#LOCAL_MODULE := NDKLIB
#LOCAL_SRC_FILES := D:/PriPro/NDKLIB/libs/armeabi-v7a/libNDKLIBRARY.so
#include $(PREBUILT_SHARED_LIBRARY)


include $(CLEAR_VARS)
LOCAL_MODULE := test
LOCAL_SRC_FILES := src/main.cpp


LOCAL_LDLIBS += -L$(SYSROOT)/usr/lib -llog
LOCAL_LDLIBS += -lGLESv3 -lEGL -landroid
#LOCAL_C_INCLUDES += D:/PriPro/NDKLIB/src \
#    D:/PriPro/NDKLIB/src/Tools \
#    D:/PriPro/NDKLIB/src/socket \
#    D:/PriPro/NDKLIB/libEx/boost/include \

#LOCAL_SHARED_LIBRARIES += NDKLIB

include $(BUILD_EXECUTABLE)

application.mk

{

APP_PLATFORM := android-18


#APP_ABI := all
APP_ABI := armeabi-v7a
#APP_ABI := armeabi

APP_STL := c++_static

APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -Wno-extern-c-compat
APP_CPPFLAGS += -Wall

APP_LDFLAGS := -latomic

#error: cannot use 'throw' with exceptions disabled
APP_CPPFLAGS += -fexceptions

APP_ALLOW_MISSING_DEPS = true


APP_SHORT_COMMANDS := true

LOCAL_ALLOW_UNDEFINED_SYMBOLS := true

}

main.cpp

{


#include <iostream>
#include <sys/socket.h>


int main(int argc, char* argv[])
{
    for (int i = 0; i < 5; i++)
    {
        printf("你好 android\n");
    }



    return 0;
}

}

ndk-builds.cmd

{

ndk-build NDK_PROJECT_PATH=./ APP_BUILD_SCRIPT=./Android.mk NDK_APPLICATION_MK=./Application.mk

}

终端

adb push youFileName /data/local/tmp

终端

adb -s devicesName  shell

cd /data/local/tmp

chmod 751 ./youFileName

./youFileName

 

ok

 编译参考 //https://www.cnblogs.com/adong7639/p/11377001.html

不支持动态库的可执行文件

 

 

}

posted @ 2020-01-31 00:28  YZFHKMS-X  阅读(103)  评论(0编辑  收藏  举报