(1)参考packages/apps/Calculator的目录结构,packages/apps下放置一个自己的应用:
xhunmon@xhunmon:~/Desktop/mydroid/packages/apps/Test$ tree
.
├── AndroidManifest.xml
├── Android.mk
├── res
│ ├── drawable
│ ├── layout
│ │ └── activity_main.xml
│ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ └── values
│ ├── colors.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── com
└── xhunmon
└── test
└── MainActivity.java
(2)其中最简单生成apk的mk文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Test
include $(BUILD_PACKAGE)
#解析
#LOCAL_PACKAGE_NAME := Calculator:生成apk名字
#include $(BUILD_PACKAGE):编译生成apk
(3)根据输出的信息可以找到生成apk的路径
out/target/product/generic/system/app/Test/Test.apk