Sometimes we need to add our own applications or modules in the source environment and publish them with ROM.
The following steps are described:
1. First you can encode the design in the SDK environment (if your app doesn't involve hardware that emulator can't emulate)
You can also refer to another article to debug the system-level application source code directly in eclipse:
Android: Debug System-level application source code based on Eclipse compilation
2. Basic debugging in the SDK environment OK
3. Copy the source code into the $Android _src/packages/apps/directory, assuming your module is MyApplication
4. Create a new android.mk file in the MyApplication directory, which can be copied from Android's own app, such as Calculator2 below, Android.mk,cleanspec.mk also copied over
5. Modify ANDROID.MK:
[HTML]View Plaincopy
- Local_path : = $ (call My-dir)
- Include $ (clear_vars)
- Local_module_tags : = Optional
- #import Gson Lib
- Local_static_java_libraries : = Libgson
- Local_src_files : = $ (call All-java-files-under, SRC)
- Local_sdk_version : = Current
- Local_package_name : = myapplication
- Include $ (build_package)
- ##################################################
- Include $ (clear_vars)
- #Add Gson Support
- Local_prebuilt_static_java_libraries : = Libgson:libs/gson-2.2.2.jar
- Include $ (build_multi_prebuilt)
- # Use the folloing include to make our test apk.
- Include $ (call all-makefiles-under,$ (Local_path))
6. Modify $Android _src/build/target/product/common.mk
[HTML]View Plaincopy
- #[email Protected],same as Local_package_name defined in ANDROID.MK
- Product_packages + = MyApplication
- #add before this line
- $ (call Inherit-product, $ (src_target_dir)/product/core.mk)
7. Compiling:
. /build/envsetup.sh
Mmm packages/apps/myapplication
Make Snod
or full compilation
Generated apk in out/target/product/related directory, related to the specific project
The ROM will be under the/system/app.
FAQ:
Q: Android Lasses-full-debug.jar] Error 41 appears at compile time
A: The Gen and Bin directories under the module directory are deleted and compiled
Based on a third-party apk built into ROM reference another article:
Android: Porting A third-party apk into the source environment in the ROM (System Image)
Android: Source Environment compiles custom app-to-ROM (System Image)