title: How to build custom system privilege app in aosp
body: <p>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</p>
  
  <p>First I put my custom app's java file, resource file, cpp file as in this below directory(packages/apps).</p>
  
  <p><a href="https://i.stack.imgur.com/L1oTC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/L1oTC.png" alt="enter image description here"></a></p>
  
  <p>And I made Android.mk file like this below.</p>
  
  <pre><code>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))
  </code></pre>
  
  <p>I also putted package name in aosp_sailfish.mk(device/google/marlin/aosp_sailfish.mk) file like this below. </p>
  
  <pre><code>PRODUCT_PACKAGE += OjtTestApp
  </code></pre>
  
  <p>After that I build my app by make OjtTestApp and build was completed without error. I tried to make apk file as in this <a href="http://devarea.com/aosp-creating-a-system-application/#.XI7gDCgzYmL" rel="nofollow noreferrer">post</a> to system/app so that my custom app can built in system image but It keeps gave me following output(obj/APPS).</p>
  
  <blockquote>
    <p>[100% 8/8] target Package: OjtTestApp (out/target/product/sailfish/obj/APPS/OjtTestApp_intermediates/package.apk)</p>
  </blockquote>
  
  <p>Please help me I can't find error in my Android.mk file.</p>