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’).

READ  Android adb shell commands

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

Leave a Reply

Your email address will not be published. Required fields are marked *