Compiling Android applicaton as part of AOSP source code

 $ cd Android_AOSP 
 $ mkdir packages/apps/HelloWorld 

Copy your java application source code to packages/apps/ e.g. HelloWorld

 $ cd packages/apps/HelloWorld 

Write an Android.mk as below,

 $vim Android.mk 

——————————————————–

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := HelloWorld
LOCAL_CERTIFICATE := platform
LOCAL_PRIVILEGED_MODULE := true

LOCAL_PROGUARD_ENABLED := disabled

include $(BUILD_PACKAGE)

——————————————————–

 Resolving Errors

1) Error: This attribute must be localized.
If you get error like below,

packages/apps/HelloWorld/res/layout/activity_main.xml:12: error: Error: This attribute must be localized. (at ‘text’ with value ‘Advertise’).

Solution :

Change packages/apps/HelloWorld/res/layout/activity_main.xml as below,

android:text=”@string/advertise”

and add this reference to res/values/string.xml:

<string name=”advertise”>Advertise</string>

Reference : Click the Link

Installing Android Application

$ ./out/host/linux-x86/bin/adb install application_name.apk

After Installing, or during installation you might get an error like, “Error : Parsing the package”, to resolve this you need to verify the ” minSdkVersion ” whether its compatible to API on your mobile or not, and correct the same or alternatively, change AndroidManifest.xml Like below to set to min. value.

<uses-sdk
– android:minSdkVersion=”11″
+ android:minSdkVersion=”1″^M

Reference : Click the Link

Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Procfs Filesystem Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply