I am trying to implement custom system app which has system privilege. I searched about it and I learned to make system app built in system image build result needs to be placed in system/app
First I put my custom app's java file, resource file, cpp file as in this below directory(packages/apps).
And I made Android.mk file like this below.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
$(info Ojt System Module)
#LOCAL_MODULE_CLASS := APPS
#LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_PACKAGE_NAME := OjtTestApp
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_STATIC_ANDROID_LIBRARIES := \
android-support-v13 \
android-support-v4 \
android-support-compat \
android-support-v7-appcompat \
android-support-v7-gridlayout
LOCAL_JNI_SHARED_LIBRARIES := libojt
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_SDK_VERSION := current
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
include $(BUILD_PACKAGE)
#include $(BUILD_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))
I also putted package name in aosp_sailfish.mk(device/google/marlin/aosp_sailfish.mk) file like this below.
PRODUCT_PACKAGE += OjtTestApp
After that I build my app by make OjtTestApp and build was completed without error. I tried to make apk file as in this post to system/app so that my custom app can built in system image but It keeps gave me following output(obj/APPS).
[100% 8/8] target Package: OjtTestApp (out/target/product/sailfish/obj/APPS/OjtTestApp_intermediates/package.apk)
Please help me I can't find error in my Android.mk file.
You don't need to go to that length. Build your apk normally don't sign it or sign it with system certificate. Now include the apk by writing a rule in as below in platform specific device.mk file
PRODUCT_PACKAGES += \
AppName
Sample mk file
LOCAL_PATH := $(call my-dir)
####################################
$(warning dont't include $(call my-dir)/Android.mk )
include $(CLEAR_VARS)
LOCAL_MODULE := <your app name>
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := PRESIGNED #If you have signed already using system key
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
#LOCAL_REQUIRED_MODULES := libnative-lib
include $(BUILD_PREBUILT)
For full privilege use
android:sharedUserId="android.uid.system" in Manifest
Related
I am trying to add a prebuilt apk to aosp source but the apk is not geting added.
Android.mk details is like
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
LOCAL_MODULE := vlc-player
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)
include $(BUILD_PREBUILT)
I have also added entry in core.mk under
PRODUCT_PACKAGES +=
vlc-player
but the apk is not added to the build
Remove the flag LOCAL_MODULE_TAGS := optional and try calling the PRODUCT_PACKAGES += vlc-player in your device specific makefile, for example in
device/google/blueline/device.mk
Also manually verify the out directory by running a separate make call like , make vlc if your module is working.
I'm making a personal build of LineageOS 17.0 that I want to include a number of pre-built APKs in. To achieve this, I have a separate folder "vendor/apps" which has two files apps-vendor.mk and Android.mk, and a sub-folder "app" which I store the APK files. This was with the help of this thread Add prebuilt apk to AOSP build.
Now, whilst I have been successful with including a number of APKs such as Blokada, FDroid, every now and then I come across an APK that I simply can't add into the build, such as TotalCommander.
If I go through the normal build process, it simply doesn't get added. If I use e.g. "mma TotalCommander" I receive an error saying "FAILED: ninja: unknown target 'TotalCommander'".
The following is what I have included in my apps-vendor.mk file:
Blokada \
FDroid \
F-DroidPrivilegedExtension \
VLC \
WaveUp \
YouTubeVancedMicroG \
YouTubeVanced \
TotalCommander
This is an excerpt from my Android.mk file:
# Custom added apps
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Blokada
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/Blokada.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := FDroid
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/FDroid.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := TotalCommander
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := app/TotalCommander.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
etc ...
I have tried a few different things, such as swapping the APK filename for one that is working, trying a different module name such as TC, etc, all of which give the same result.
I feel silly, but the issue was this. I originally had the folder directly under vendor, but then I moved the folder to a parent directory and symlinked it. Building does not work properly with symlinks like this. I still detects the vendor-apps.mk file, and when it is changed, but it doesn't actually add any rules.
I'm building a custom ROM and would like to include a simple launcher I built as a system app. Here is my Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# General
LOCAL_PACKAGE_NAME := Tott
LOCAL_SDK_VERSION := current
LOCAL_MODULE_TAGS := optional
LOCAL_PROGUARD_ENABLED := disabled
# To make system app
LOCAL_CERTIFICATE := platform
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_PRIVILEGED_MODULE := true
LOCAL_OVERRIDES_PACKAGES := Home Launcher2 Launcher3
# src/res files
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
# libraries
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-appcompat
#flags
LOCAL_AAPT_FLAGS := \
--auto-add-overlay \
--extra-packages android.support.v7.appcompat
include $(BUILD_PACKAGE)
I have placed the Android.mk, AndroidManifest.xml, res folder, and src (containing java) in a directory called Tott which has been placed in [source]/packages/apps. I've also added Tott to PRODUCT_PACKAGES at [source]/build/target/product/core.mk
When I build the android system.img, it says that that it is including [source]/packages/apps/Tott/Android.mk in terminal but my app never shows in [source]/out/target/product/vender/system/app or priv-app. I'm also able to build my app successfully by simply running make Tott at [source].
What am I doing wrong here????
Thanks
Comment out LOCAL_SDK_VERSION and LOCAL_UNINSTALLABLE_MODULE. I don't use those in my Android.mk files and I never have a problem.
I am trying to add my app in Android_source/Development/apps/ folder. I confirmed that my code is compiled, as if i add syntax error compiler stopped there.
But the thing is that my app is not getting shown in apps menu. should i add my app package somewhere else too.
Android.Mk file content(i copied these contents from Bluetooth App in packages/apps/Bluetooth)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := \
$(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Bluetooth_LE
LOCAL_CERTIFICATE := platform
#LOCAL_JNI_SHARED_LIBRARIES := libbluetooth_jni
LOCAL_JAVA_LIBRARIES := javax.obex
LOCAL_STATIC_JAVA_LIBRARIES := com.android.vcard
LOCAL_REQUIRED_MODULES := libbluetooth_jni bluetooth.default
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
It seems that you've forgot to include your package into the build. Put the name of your module (Bluetooth_LE) into appropriate build file (for instance, into build/target/product/core.mk) into section PRODUCT_PACKAGES.
I want to add my pre-built APK to my AOSP build. I've created the following folders vendor/aaa/crespo and pasted my APK inside the folder. I've also created a make file to install my APK.
The make file is as follows:
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
include $(CLEAR_VARS)
LOCAL_MODULE_PATH := vendor/aaa/crespo/
LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
ifeq ($(LOCAL_MODULE_PATH),)
LOCAL_MODULE_PATH := $($(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS))
ifeq ($(strip $(LOCAL_MODULE_PATH)),)
$(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
endif
endif
# Module name should match apk name to be installed.
LOCAL_MODULE := test
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
Can anyone tell me what is wrong with the make file? In this make file, I want to tell the compiler to add my APK into the build. It builds fine but my app is not present in the installed-files.txt file.
Reading build script at github
LOCAL_MODULE_PATH := $(strip $(LOCAL_MODULE_PATH))
ifeq ($(LOCAL_MODULE_PATH),)
LOCAL_MODULE_PATH := $($(my_prefix)OUT$(partition_tag)_$(LOCAL_MODULE_CLASS))
ifeq ($(strip $(LOCAL_MODULE_PATH)),)
$(error $(LOCAL_PATH): unhandled LOCAL_MODULE_CLASS "$(LOCAL_MODULE_CLASS)")
endif
endif
It is your path that's wrong. If Android.mk is at the same directory, I don't think you need to put path in front of it. By the way you are also not setting LOCAL_CERTIFICATE - I don't know if necessary but majority seems to set it.
In my case it helped to include Android.mk with definitions via macro all-makefiles-under:
include $(call all-makefiles-under, $(LOCAL_PATH))
Problem occurred when i include Android.mk directly.