SoFunction
Updated on 2025-03-11

Android simply modify the original application and add the application method

This article describes how Android simply modifys the original application and adds applications. Share it for your reference, as follows:

Part 1: How to modify the original Android application

1. First create a new Android project and load your own Java files and resource files.

2. After the initial debugging of your android project is successful, copy the java file and resource file of the project to the corresponding java file and resource file directory of the contact person.

3. Execute the following command in linux to compile the contact module and compile the resource file into the contact directory

. build/
mmm packages/apps/Contacts

4. Refresh the Android source code project. At this time, you can see the newly added resource files and source files in the Contacts package directory, and you can modify the code under the source code project and debug it directly.

5. After the source code project is modified, you can execute the contact compilation command again under Linux, make snod load the file, and start the emulator (emulator &), so that you can see your modifications.

Question: Why do we need to compile the required xml resource files in linux first?

Answer: Because our Android source code project is imported from Java project, if the android xml file is added, the java program cannot recognize the resource R file, so we must first compile the required xml resource file in linux first.

Part 2: How to Add a New Android App

1. First confirm that the SDK directory is the same as the system version, and then develop your own android application in the SDK directory.

2. Create an Android project in the source code packages/apps/ directory.

3. Add a file in the project directory and modify LOCAL_PACKAGE_NAME. Specify the project name as the project name yourself. If my project name is test, then LOCAL_PACKAGE_NAME:=test.

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := user
LOCAL_SRC_FILES := $(callall-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES :=googlelogin-client
LOCAL_PACKAGE_NAME :=test
LOCAL_CERTIFICATE := shared
include $(BUILD_PACKAGE)
# Use the folloing include to make our testapk.
include $(callall-makefiles-under,$(LOCAL_PATH))

4. Return to the source directory first, and then execute .build/ (Pay attention to the spaces after sh

5. Execute mmmmpackages/apps/test001 and compile the package

6. Execute make snod and compile the package, then execute emulator &

In this way, you can see the project you compiled in the application.

For more information about Android related content, please check out the topic of this site:Android development introduction and advanced tutorial》、《Android View View Tips Summary》、《Android programming activity operation skills summary》、《Summary of Android's SQLite database skills》、《Summary of Android data skills for operating json format》、《Android database operation skills summary》、《Android file operation skills summary》、《A summary of SD card operation methods for Android programming and development》、《Android resource operation skills summary"and"Android control usage summary

I hope this article will be helpful to everyone's Android programming design.