Android: Source Environment compiles custom app-to-ROM (System Image)

Source: Internet
Author: User

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
  1. Local_path : = $ (call My-dir)
  2. Include $ (clear_vars)
  3. Local_module_tags : = Optional
  4. #import Gson Lib
  5. Local_static_java_libraries : = Libgson
  6. Local_src_files : = $ (call All-java-files-under, SRC)
  7. Local_sdk_version : = Current
  8. Local_package_name : = myapplication
  9. Include $ (build_package)
  10. ##################################################
  11. Include $ (clear_vars)
  12. #Add Gson Support
  13. Local_prebuilt_static_java_libraries : = Libgson:libs/gson-2.2.2.jar
  14. Include $ (build_multi_prebuilt)
  15. # Use the folloing include to make our test apk.
  16. Include $ (call all-makefiles-under,$ (Local_path))

6. Modify $Android _src/build/target/product/common.mk

[HTML]View Plaincopy
    1. #[email Protected],same as Local_package_name defined in ANDROID.MK
    2. Product_packages + = MyApplication
    3. #add before this line
    4. $ (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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.