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.
Related
I am building an AOSP version for the first time and trying to put my application as a system app. So i made this android.mk file but during during build process, it is giving out error - Package modules may not define LOCAL_MODULE_SUFFIX. Can please someone help me out.
Alternatives to this method are also welcome, i just need to install my application as system app so that it gets more permissions.
My android.mk file is :-
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := CallRecorder_static
LOCAL_SRC_FILES := $(call all-java-files-under, java)
LOCAL_RESOURCE_DIR = $(LOCAL_PATH)/res
include $(BUILD_STATIC_JAVA_LIBRARY)
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_PACKAGE_NAME := CallRecorder
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_PRIVILEGED_MODULE := true
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := libarity android-support-v4
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
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
I want to use a pre-built shared library in AOSP. The library is defined in Android.mk like this:
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_TAG := optional
LOCAL_MODULE_PATH := system/lib
LOCAL_SRC_FILE := system/lib/foo.so
include $(BUILD_PREBUILT)
During build, a folder out/target/product/mako/obj/SHARED_LIBRARIES/foo_intermediates/export_include
was created.
However, the build failed with error message that out/target/product/mako/obj_arm/SHARED_LIBRARIES/foo_intermediates/export_include cannot be found.
Note the difference between "obj" and "obj_arm". What caused the problem?
This is two-target build (arm and arm64), so there are two obj folders, one for 32-bit arm and the other for 64-bit arm.
I need to define the library as follows:
include $(CLEAR_VARS)
LOCAL_MODULE := libfoo
LOCAL_MODULE_SUFFIX :=.so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_TAGS := optional
LOCAL_PRELINK_MODULE := false
ifdef TARGET_2ND_ARCH
LOCAL_MULTILIB := both
LOCAL_MODULE_PATH_64 := system/lib64
LOCAL_SRC_FILES_64 := system/lib64/libfoo.so
LOCAL_MODULE_PATH_32 := system/lib
LOCAL_SRC_FILES_32 := system/lib/libfoo.so
else
LOCAL_MODULE_PATH := system/lib
LOCAL_SRC_FILES := system/lib/libfoo.so
endif
include $(BUILD_PREBUILT)
I need to change Settings app by adding some custom library to it but I am having problems with configuration. When I try to call System.loadLibrary("mylibrary") i get libraryPath=/data/app-lib/com.settings-1: find library returned null. I know that app will look inside /data/app-lib/.. folder for specific library but my library is in system/lib
I know that my .mk files are not OK but I don't know what am I missing, please take look at them.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_JAVA_LIBRARIES := bouncycastle telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := guava android-support-v4 jsr305
ifdef DOLBY_DAP
LOCAL_JAVA_LIBRARIES += framework_ext
else
LOCAL_STATIC_JAVA_LIBRARIES += libsds
endif #DOLBY_DAP
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := Settings
LOCAL_CERTIFICATE := platform
# If this is an unbundled build (to install seprately) then include
# the libraries in the APK, otherwise just put them in /system/lib and
# leave them out of the APK
ifneq (,$(TARGET_BUILD_APPS))
LOCAL_JNI_SHARED_LIBRARIES := efuse_tool
else
LOCAL_REQUIRED_MODULES := efuse_tool
endif
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
include $(BUILD_PACKAGE)
include $(call all-makefiles-under, jni)
ifndef DOLBY_DAP
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := libsds:ds.jar
include $(BUILD_MULTI_PREBUILT)
endif
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
And .mk file inside jni folder
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Here we give our module name and source file(s)
LOCAL_SRC_FILES := efuse_tool.c
LOCAL_MODULE := efuse_tool
include $(BUILD_SHARED_LIBRARY)
I realized that I have to add prefix "lib" to my library so it will be called from system/lib location. So it should look like this
ifneq (,$(TARGET_BUILD_APPS))
LOCAL_JNI_SHARED_LIBRARIES := libefuse_tool
else
LOCAL_REQUIRED_MODULES := libefuse_tool
endif
LOCAL_MODULE := libefuse_tool
I can also remove LOCAL_JNI_SHARED_LIBRARIES := libefuse_tool because it will never be used.
I'm compiling an Android ROM from source, and I have several apps that compile, but into data/app on the phone. They're uninstallable through the phone settings. I want them to be impossible to uninstall from the phone, and to compile into system/app instead of data/app.
Any advice?
edit:typo
Add:
LOCAL_MODULE_PATH := system/app
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_CERTIFICATE := platform
Here is an example of mk file that you can use. In my case the application is then build into system/app:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := package_name
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
# Use the folloing include to make our test app
include $(call all-makefiles-under,$(LOCAL_PATH))
With cm_10.2, I added my app into packages/apps and by default, mm built it into /data/app. I wanted it into system/app. It worked by adding this into Android.mk :
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
But I'm not sure if it's a clean way to proceed since I almost found nobody doing that.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := MyTestApp
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_PRIVILEGED_MODULE := true
LOCAL_STATIC_JAVA_LIBRARIES := libarity android-support-v4
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))