Android.mk转换到Android.bp方法

1.源码在:build/soong/androidmk

2.编译源码后,androidmk生成工具位置
# out/soong/host/linux-x86/bin/androidmk

3.使用命令
栗子:Android.mk
LOCAL_PATH:= $(call my-dir)                                                                                                                                                                                                                                                                                                                                                                                                    
include $(CLEAR_VARS)                                                                                                                                                                                           
LOCAL_PRIVATE_PLATFORM_APIS := true                                                                                                                                                                             
LOCAL_MODULE_TAGS := optional                                                                                                                                                                                   
LOCAL_CERTIFICATE := platform                                                                                                                                                                                   
LOCAL_SRC_FILES := $(call all-java-files-under, src)                                                                                                                                                            
LOCAL_PACKAGE_NAME := test                                                                                                                                                                                      
LOCAL_DEX_PREOPT := false                                                                                                                                                                                                                                                                                                                                                                                                 
include $(BUILD_PACKAGE)

# androidmk  Android.mk > Android.bp
Android.bp生成如下:
android_app {                                                                                                                                                                                                                                                                                                                            
// LOCAL_PRIVATE_PLATFORM_APIS := true                                                                                                                                                                                                        
    certificate: "platform",                                                                                                                                                                                    
    srcs: ["src/**/*.java"],                                                                                                                                                                                    
    name: "test",                                                                                                                                                                                               
    dex_preopt: {                                                                                                                                                                                               
        enabled: false,                                                                                                                                                                                         
    },                                                                                                                                                                                                                                                                                                                                                                                                                          
}

4.禁止framework/base/Android.bp生成odex
java_library {
  name: "framework",
  //禁止生成odex
  dex_preopt: {                                                                                                                                                                                              
      enabled: false,                                                                                                                                                                                        
  },

  srcs: []
}

5.编译可执行程序:Android.mk---->Android.np
<1>.Android.mk
LOCAL_PATH := $(call my-dir)                                                                                                                                                                                    
                                                                                                                                                                                                               include $(CLEAR_VARS)                                                                                                                                                                                           
#LOCAL_C_INCLUDES:= external/tinyalsa/include                                                                                                                                                                   
#LOCAL_CPPFLAGS := -std=c++11 -Wall -Werror #C++                                                                                                                                                                
LOCAL_MODULE_TAGS := optional                                                                                                                                                                                   
LOCAL_MODULE := test_bb                                                                                                                                                                                         
LOCAL_SRC_FILES := test.c                                                                                                                                                                                       
LOCAL_CFLAGS += -Wall -Werror                                                                                                                                                                                   
LOCAL_SHARED_LIBRARIES:= libcutils libutils                                                                                                                                                                     
include $(BUILD_EXECUTABLE) 

# androidmk Android.mk > Android.bp
<2>.Android.bp
cc_binary {                                                                                                                                                                                                     
    //LOCAL_C_INCLUDES:= external/tinyalsa/include                                                                                                                                                              
    //LOCAL_CPPFLAGS := -std=c++11 -Wall -Werror #C++                                                                                                                                                           
                                                                                                                                                                                                                
    name: "test_bb",                                                                                                                                                                                            
    srcs: ["test.c"],                                                                                                                                                                                           
    cflags: [                                                                                                                                                                                                   
        "-Wall",                                                                                                                                                                                                
        "-Werror",                                                                                                                                                                                              
    ],                                                                                                                                                                                                          
    shared_libs: [                                                                                                                                                                                              
        "libcutils",                                                                                                                                                                                            
        "libutils",                                                                                                                                                                                             
    ],                                                                                                                                                                                                          
}

 

你可能感兴趣的:(Android,系统调试方法)