I want to build a rom from source and include my app as system app. What I've tried:
1.Copy my project into $SOURCE_DIR/packages/apps/
2.add Android.mk in root folder of my project:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_STATIC_JAVA_LIBRARIES := android-common
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := packagename
LOCAL_CERTIFICATE := platform
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
3.Configure building for maguro and:
make -j1 otapackage
But I don't see my app in output image's /system/app directory.
What am I missing?
I do not see in your mk file the following line:
LOCAL_MODULE_TAGS := optional
And I guess you have just forgotten to include your package into build/target/product/core.mk file under the section PRODUCT_PACKAGES
Related
I found similar posts but often the answer are not really correct and anyways seems to be not working for me.
I have an Android application created with Android Studio which includes java-websocket library. Now, I want to build this application inside AOSP thus I created a folder for the jar library with its own Android.mk and another folder which contains the application (with Android Studio structure) which contains its own Android.mk (modified in order to find AndroidManifest, res, java, AIDL files)
At first I had some troubles due to some incorrect parameter in the Android.mk for the jar file. Now the jar file seems to be correctly recognized and the intermediates are exported to out/ folder.
The problem now is during the build of the application since the classes exposed by the jar seems to be not available ending up in:
error: cannot find symbol WebSocket
and similar errors for any reference to the jar content.
The JAR folder contains: Android.mk Java-WebSocket-1.3.0.jar
And this is the Android.mk content
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := JavaWebSocket
LOCAL_MODULE_TAGS := optional
$(warning Going to build $(LOCAL_MODULE))
LOCAL_SRC_FILES := Java-WebSocket-1.3.0.jar
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
The application folder contains: Android.mk aidl_files app gradle build.gradle ..
(basically the Android Studio project plus the Android.mk and a folder containing AIDL (which I'll move outside later)
And this is the Android.mk file content:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PACKAGE_NAME := MyApplication
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := JavaWebSocket
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, app/src/main/java) \
aidl_files/my_aidl_file.aidl
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl_files
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/app/src/main/res
LOCAL_MANIFEST_FILE := app/src/main/AndroidManifest.xml
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_STATIC_ANDROID_LIBRARIES += \
androidx.appcompat_appcompat
include $(BUILD_PACKAGE)
I tried to merge all the informations I found in StackOverflow so far without success.
Is there any other LOCAL_something that I should set?
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'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 external JAR files (e.g., gson or eventbus) to my AOSP build. I tried it in two different ways:
Adding them to prebuilts/misc/common/mylibs/ and creating a Android.mk file for the dir. Then, I merely include the symbolic name of the lib in my app's Android.mk file.
Adding them in a subdir libs in my custom app source code and add it via the app's Android.mk file directly.
However, both approaches are yielding me similar errors, the following for the second method:
ninja: error: 'packages/apps/Car/MyApp/packages/apps/Car/Myapp/libs/gson-2.6.2.jar', needed by 'out/target/common/obj/JAVA_LIBRARIES/gson_intermediate/classes.jack', missing and no known rule to make it.
I noticed the weird repeating path in the error message. Does anybody have an idea what I am doing wrong?
Here is my Android.mk file for the second way:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_PACKAGE_NAME := MyApp
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_TAGS := optional
LOCAL_PRIVILEGED_MODULE := true
LOCAL_STATIC_JAVA_LIBRARIES += jsr305 gson
LOCAL_STATIC_ANDROID_LIBRARIES := android-support-v4
LOCAL_USE_AAPT2 := true
include packages/apps/Car/libs/car-stream-ui-lib/car-stream-ui-lib.mk
include packages/services/Car/car-support-lib/car-support.mk
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := gson:$(LOCAL_PATH)/libs/gson-2.6.2.jar
include $(BUILD_MULTI_PREBUILT)
Removing $(LOCAL_PATH) from the path fixed it.
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.