How the BBM Android Application Get the Incoming Message

June 30, 2017

The routine to process incoming and outgoing message resides in BbmCoreService.java. This is after the libbbmcore.so library is loaded and proper authentication process is done successfully.

After libbbmcore.so is loaded and functional, periodically it will call a method in BbmCoreService class called prv_msgFromService. This is the incoming messages, which has many types, including advertising messages. This in turn will call the callback and other necessary routines, such as notifications, etc.

Likewise, the outgoing message is constructed to suitable format before sending it via the native method called prv_msgToService, also in libbbmcore.so.

Hope this small burst of information can help 🙂

After more detailed examination, I can added that the routine to handle incoming message resides in libtransport.so native library. It is implemented using socket, connect, select and recv socket functions.

On the start up of this library (i.e. the libtransport.so), it tries to connect to one of the BBM server IP Addresses, which is from 74.82.64.0 to 74.82.95.255, using SOCK_DGRAM connection type.

The received data is in encrypted form, and it is decrypted locally using SSL_read combined with BIO_write function, after properly set up the link between BIO and SSL functions using SSL_set_bio.

After the received data is processed, the libtransport.so routine will perform write to the created write end point of the pipe from libbbmcore.so routines. This will trigger the necessary functions such as showing the Notification with is BBM tone, etc.

How to Compile Android Lollipop (5.1.1) Contacts onWindows OS

June 21, 2017

This is the modified build system to be used to compile existing APK from Android Lollipop 5.1.1 Framework. In this example it is used to compile Android’s Contacts.apk.

You can used it also to compile another Android packages.

The build system is taken from android-5.1.1_r38 source tree. Basically the compile error is not finding which module that is required, the slash or backslash problem and certain script code that is not supported by bash shell on Windows OS.

There’s also the problem when unzipping the download *.gz file from Android source repository. You should use the gzip and tar command line program from MSYS or GNUWIN32.

The build script is proven to be successfully run on windows version 7-6.1.7601-SP1.

The modified build scripts already uploaded to github:

https://github.com/surya-rakanta/AndroidBuildSystemOnWindows

Below is the log of compiling session from start to finish and how to solve each compiling issue one by one.

The script is checked and revised using the probe text such as until …, etc, so you will see some weird output such as until herexxy9aay2, etc, in the compiling session log below. Ignore it.

You can examine the final modified build system in the downloaded from github.

Retrieve the source from:

https://android.googlesource.com/platform/packages/apps/Contacts/+/android-5.1.1_r38

Put it into structures here:

D:\Projects\Lollipop\platform\packages\apps\Contacts

Download build system:

https://android.googlesource.com/platform/build/+/android-5.1.1_r38

Put it here:

D:\Projects\Lollipop\platform\build

Perform modification in envsetup.sh, but first copy this shell file into back up file

Execute envsetup.sh, and we have:

D:\Projects\Lollipop\platform\build>bash
bash-3.1$ ./envsetup.sh
./envsetup.sh: line 1134: unexpected argument `(‘ to conditional binary operator

./envsetup.sh: line 1134: syntax error near `(^’
./envsetup.sh: line 1134: ` if [[ $CPU_ABI =~ (^|,)arm64 ]]; then’

Remark it

We have:

bash-3.1$ ./envsetup.sh
./envsetup.sh: line 1184: unexpected argument `(‘ to conditional binary operator

./envsetup.sh: line 1184: syntax error near `(^’
./envsetup.sh: line 1184: ` if [[ $EXE =~ (^|/)(app_process|dalvikvm)(|32|64)$
]]; then’

Remark again:

We have:

bash-3.1$ ./envsetup.sh
./envsetup.sh: line 1279: unexpected argument `(‘ to conditional binary operator

./envsetup.sh: line 1279: syntax error near `(^’
./envsetup.sh: line 1279: ` if [[ $EXE =~ (^|/)(app_process|dalvikvm)(|32|
64)$ ]]; then’

Remark

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/envsetup.mk:67: *** Unable to determine HOST_OS from uname -sm: MINGW
32_NT-6.1 i686!. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets ####

Modify in D:\Projects\Lollipop\platform\build\core\envsetup.mk:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/envsetup.mk:94: *** Unable to determine HOST_ARCH from uname -sm: MIN
GW32_NT-6.1 i686!. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets ####

Modify in D:\Projects\Lollipop\platform\build\core\envsetup.mk:

HOST_ARCH := x86

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/config.mk:454: *** Error: could not find jdk tools.jar, please check
if your JDK was installed correctly. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (1 seconds) ####

Checking:

D:\Projects\Lollipop\platform>bash
bash-3.1$ build/core/find-jdk-tools-jar.sh
/c/Program Files (x86)/Java/jdk1.6.0_26/lib/tools.jar

Remark in D:\Projects\Lollipop\platform\build\core\config.mk:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
Checking build tools versions…
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: java version “1.8.0_131” Java(TM) SE Runtime Environment (build
1.8.0_131-b11) Java HotSpot(TM) Client VM (build 25.131-b11, mixed mode, sharin
g).
The required version is: “1.7.x”

Please follow the machine setup instructions at
https://source.android.com/source/initializing.html
************************************************************
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/main.mk:167: *** stop. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (6 seconds) ####

bash-3.1$

Install jdk-7u79-windows-i586.exe, change windows path environment and verify:

C:\Windows\System32>java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) Client VM (build 24.79-b02, mixed mode, sharing)

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
Checking build tools versions…
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/main.mk:459: sdk/build/windows_sdk_whitelist.mk: No such file or dire
ctory
build/core/main.mk:460: development/build/windows_sdk_whitelist.mk: No such file
or directory
including build/tools/acp\Android.mk …

#### make failed to build some targets (32 seconds) ####

bash-3.1$

And the windows crash:

The cause of this crash is located at D:\Projects\Lollipop\platform\build\core\base_rules.mk:

gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)

Create a test make file called mktest.mk inside D:\Projects\Lollipop\platform with content as follows:

#SHELL := /bin/bash

###########################################################
## Scan through each directory of $(1) looking for files
## that match $(2) using $(wildcard). Useful for seeing if
## a given directory or one of its parents contains
## a particular file. Returns the first match found,
## starting furthest from the root.
###########################################################
$(info until herexxy9aa1)

define find-parent-file
$(strip \
$(eval _fpf := $(wildcard $(foreach f, $(2), $(strip $(1))/$(f)))) \
$(if $(_fpf),$(_fpf), \
$(if $(filter-out ./ .,$(1)), \
$(call find-parent-file,$(patsubst %/,%,$(dir $(1))),$(2)) \
) \
) \
)
endef

LOCAL_PATH := “build/tools/acp\”
$(info until $(LOCAL_PATH))

gpl_license_file := $(call find-parent-file,$(LOCAL_PATH),MODULE_LICENSE*_GPL* MODULE_LICENSE*_MPL* MODULE_LICENSE*_LGPL*)

The cause of make program crash is present of unwanted backslash in build/tools/acp\

Remark by making gpl_license_file blank for the moment, we have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/main.mk:459: sdk/build/windows_sdk_whitelist.mk: No such file or dire
ctory
build/core/main.mk:460: development/build/windows_sdk_whitelist.mk: No such file
or directory
including build/tools/acp\Android.mk …
until herexxy9aay2
make: *** No rule to make target `development/build/windows_sdk_whitelist.mk’.
Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (13 seconds) ####

Retrieve sdk tree.

Place it in in local directory

Retrieve development tree from:

Place it in:

Change envsetup.sh script inside function make():

local start_time=$(date +”%s”)
#$(get_make_command) “$@”
command make -C /d/Projects/Lollipop/platform -f build/core/main.mk BUILD_MODULES_IN_PATHS=d:/Projects/Lollipop/platform/packages/apps/Contacts -p > myMake1.txt

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
/bin/bash: line 0: cd: development/appsBluetoothDebug : No such file or director
y
/bin/bash: line 0: cd: development/appsBuildWidget : No such file or directory
find: src: No such file or directory
build/core/java.mk:23: *** development/apps\BuildWidget\: Invalid LOCAL_SDK_VERS
ION ‘current’ Choices are: . Stop.

#### make failed to build some targets (11 seconds) ####

Checking the included sub directories in D:\Projects\Lollipop\platform\build\core\main.mk using info statement:

D:\Projects\Lollipop\platform\build\core\main.mk

We get the result:

the sub dirs external/openssl prebuilt prebuilts build/libs/host build/tools/z
ipalign dalvik/dexdump dalvik/libdex dalvik/tools/dmtracedump dalvik/tools/hprof
-conv development/host development/tools/etc1tool development/tools/line_endings
external/clang external/easymock external/expat external/gtest external/libcxx
external/libcxxabi external/compiler-rt external/libpng external/llvm external/s
qlite/dist external/zlib external/zopfli frameworks/base frameworks/compile fram
eworks/native frameworks/rs frameworks/tools system/core/adb system/core/fastboo
t system/core/libcutils system/core/liblog system/core/libsparse system/core/lib
ziparchive system/core/libzipfile system/core/libutils system/extras/ext4_utils
build/tools/signapk dalvik/dx libcore development/apps development/tools/mkstubs
frameworks/compile/libbcc packages build/tools/acp

Probing with:

$(info the sub dir make file $(subdir_makefiles))

We get:

the sub dir make file build/libs/host\Android.mk build/tools/acp\Android.mk buil
d/tools/signapk\Android.mk build/tools/zipalign\Android.mk development/apps\Blue
toothDebug\Android.mk development/apps\BuildWidget\Android.mk development/apps\C
ustomLocale\Android.mk development/apps\DevelopmentSettings\Android.mk developme
nt/apps\Development\Android.mk development/apps\Fallback\Android.mk development/
apps\GestureBuilder\Android.mk development/apps\NinePatchLab\Android.mk developm
ent/apps\OBJViewer\Android.mk development/apps\SdkSetup\Android.mk development/a
pps\SettingInjectorSample\Android.mk development/apps\WidgetPreview\Android.mk d
evelopment/apps\launchperf\Android.mk development/host\Android.mk development/to
ols/etc1tool\Android.mk development/tools/line_endings\Android.mk development/to
ols/mkstubs\Android.mk packages\apps\ContactsCommon\Android.mk packages\apps\Con
tacts\Android.mk

Most of the program is not needed, so just re-assign the subdir_makefiles in D:\Projects\Lollipop\platform\build\core\main.mk:

subdir_makefiles := packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk

Now we have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including packages/apps/ContactsCommon/Android.mk …
find: ../PhoneCommon/src: No such file or directory
including packages/apps/Contacts/Android.mk …
find: ../PhoneCommon/src: No such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `prebuilts/sdk/api/.txt’, needed by `out/target
/common/obj/PACKAGING/checkpublicapi-last-timestamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (14 seconds) ####

bash-3.1$

Retrieve PhoneCommon source tree from:

Place it in:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `prebuilts/sdk/api/.txt’, needed by `out/target
/common/obj/PACKAGING/checkpublicapi-last-timestamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (15 seconds) ####

bash-3.1$

Copy files from:

Place it in:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
make: *** No rule to make target `out/target/common/obj/PACKAGING/public_api.txt
‘, needed by `out/target/common/obj/PACKAGING/checkpublicapi-last-timestamp’. S
top.

#### make failed to build some targets (14 seconds) ####

out/target/common/obj/PACKAGING/checkpublicapi-last-timestamp: prebuilts/sdk/api/22.txt out/target/common/obj/PACKAGING/public_api.txt frameworks/base/api/removed.txt out/host/windows-x86/bin/apicheck.exe out/target/common/docs/api-stubs-timestamp
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# variable set hash-table stats:
# Load=0/32=0%, Rehash=0, Collisions=0/0=0%
# commands to execute (from `build/core/tasks/apicheck.mk’, line 46):
@echo “Checking API:” checkpublicapi-last
@ ( out/host/windows-x86/bin/apicheck.exe -JXmx1024m -J”classpath /c/Program Files (x86)/Java/jdk1.7.0_79/lib/tools.jar:out/host/windows-x86/framework/doclava.jar:out/host/windows-x86/framework/jsilver.jar” -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 -error 16 -error 17 -error 18 prebuilts/sdk/api/22.txt out/target/common/obj/PACKAGING/public_api.txt frameworks/base/api/removed.txt out/target/common/obj/PACKAGING/removed.txt || ( cat build/core/apicheck_msg_last.txt ; exit 38 ) )
@ mkdir -p $(dir $@)
@ touch $@

# INTERNAL_PLATFORM_API_FILE is the one build by droiddoc.
# Note that since INTERNAL_PLATFORM_API_FILE is the byproduct of api-stubs module,
# (See frameworks/base/Android.mk)
# we need to add api-stubs as additional dependency of the api check.

# Check that the API we’re building hasn’t broken the last-released
# SDK version.
$(eval $(call check-api, \
checkpublicapi-last, \
$(SRC_API_DIR)/$(last_released_sdk_version).txt, \
$(INTERNAL_PLATFORM_API_FILE), \
frameworks/base/api/removed.txt, \
$(INTERNAL_PLATFORM_REMOVED_API_FILE), \
-hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 -hide 26 -hide 27 \
-error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \
-error 16 -error 17 -error 18 , \
cat $(BUILD_SYSTEM)/apicheck_msg_last.txt, \
check-public-api, \
$(call doc-timestamp-for,api-stubs) \
))

The out/target/common/obj/PACKAGING/public_api.txt is generated by the command:

update-public-api: out/target/common/obj/PACKAGING/public_api.txt | out/host/-x86/bin/acp
# Phony target (prerequisite of .PHONY).
# Implicit rule search has not been done.
# File does not exist.
# File has not been updated.
# commands to execute (from `build/core/tasks/apicheck.mk’, line 79):
@echo Copying current.txt
$(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) frameworks/base/api/current.txt
@echo Copying removed.txt
$(hide) $(ACP) $(INTERNAL_PLATFORM_REMOVED_API_FILE) frameworks/base/api/removed.txt

Retrieve source tree from:

Place it in:

But we still have:

make: *** No rule to make target `out/target/common/obj/PACKAGING/public_api.txt
‘, needed by `out/target/common/obj/PACKAGING/checkpublicapi-last-timestamp’. S
top.

Let’s try to build ACP first, but we have:

# ACP is always for the build OS, not for the host OS
ACP := $(BUILD_OUT_EXECUTABLES)/acp$(BUILD_EXECUTABLE_SUFFIX)

BUILD_OUT_EXECUTABLES := out/host/-x86/bin

Which is:

BUILD_OUT_EXECUTABLES := $(BUILD_OUT)/bin

Where as:

BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)

Modify in D:\Projects\Lollipop\platform\build\core\envsetup.mk:

Let’s revert to original one:

command make -C /d/Projects/Lollipop/platform -f build/core/main.mk all_modules BUILD_MODULES_IN_PATHS= build/d:/Projects/Lollipop/platform/packages/apps/Contacts -p > myMake2.txt

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including build/libs/host\Android.mk …
including build/tools/acp\Android.mk …
including build/tools/signapk\Android.mk …
including build/tools/zipalign\Android.mk …
including development/apps\BluetoothDebug\Android.mk …
/bin/bash: line 0: cd: development/appsBluetoothDebug : No such file or director
y
including development/apps\BuildWidget\Android.mk …
/bin/bash: line 0: cd: development/appsBuildWidget : No such file or directory
find: src: No such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** development/apps\BuildWidget\: Invalid LOCAL_SDK_VERS
ION ‘current’ Choices are: . Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (11 seconds) ####

bash-3.1$

Check environment variables:

Choices are: $(TARGET_AVAILABLE_SDK_VERSIONS))

# makefile (from `build/core/config.mk’, line 599)
TARGET_AVAILABLE_SDK_VERSIONS :=

TARGET_AVAILABLE_SDK_VERSIONS := $(call numerically_sort,\
$(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \
$(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar)))

HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk

Download from:

Place it in:

We have:

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including build/libs/host\Android.mk …
including build/tools/acp\Android.mk …
including build/tools/signapk\Android.mk …
including build/tools/zipalign\Android.mk …
including development/apps\BluetoothDebug\Android.mk …
/bin/bash: line 0: cd: development/appsBluetoothDebug : No such file or director
y
including development/apps\BuildWidget\Android.mk …
/bin/bash: line 0: cd: development/appsBuildWidget : No such file or directory
find: src: No such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** development/apps\BuildWidget\: Invalid LOCAL_SDK_VERS
ION ‘current’ Choices are: 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (11 seconds) ####

bash-3.1$

Edit the subdir_makefiles to:

subdir_makefiles := build/libs/host\Android.mk build/tools/acp\Android.mk build/tools/signapk\Android.mk build/tools/zipalign\Android.mk development/apps/BluetoothDebug\Android.mk development/apps/BuildWidget\Android.mk development/apps/CustomLocale\Android.mk development/apps\DevelopmentSettings\Android.mk development/apps/Development\Android.mk development/apps/Fallback\Android.mk development/apps/GestureBuilder\Android.mk development/apps/NinePatchLab\Android.mk development/apps/OBJViewer\Android.mk development/apps/SdkSetup\Android.mk development/apps/SettingInjectorSample\Android.mk development/apps/WidgetPreview\Android.mk development/apps/launchperf\Android.mk development/host\Android.mk development/tools/etc1tool\Android.mk development/tools/line_endings\Android.mk development/tools/mkstubs\Android.mk packages/apps/ContactsCommon\Android.mk packages/apps/Contacts\Android.mk

And change the command inside function make():

command make -C /d/Projects/Lollipop/platform -f build/core/main.mk all_modules BUILD_MODULES_IN_PATHS= d:/Projects/Lollipop/platform/packages/apps/Contacts

bash-3.1$ ./envsetup.sh
ps: illegal option — o
Usage ps [-aefl] [-u uid]
-f = show process uids, ppids
-l = show process uids, ppids, pgids, winpids
-u uid = list processes owned by uid
-a, -e = show processes of all users
-s = show process summary
-W = show windows as well as cygwin processes
WARNING: Only bash is supported, use of other shell would lead to erroneous resu
lts
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.1.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86
HOST_OS=windows
HOST_OS_EXTRA=Windows-7-6.1.7601-SP1
HOST_BUILD_TYPE=release
BUILD_ID=LMY49M
OUT_DIR=out
============================================
including build/libs/host\Android.mk …
including build/tools/acp\Android.mk …
including build/tools/signapk\Android.mk …
including build/tools/zipalign\Android.mk …
including development/apps/BluetoothDebug\Android.mk …
including development/apps/BuildWidget\Android.mk …
including development/apps/CustomLocale\Android.mk …
including development/apps\DevelopmentSettings\Android.mk …
including development/apps/Development\Android.mk …
including development/apps/Fallback\Android.mk …
including development/apps/GestureBuilder\Android.mk …
including development/apps/NinePatchLab\Android.mk …
including development/apps/OBJViewer\Android.mk …
including development/apps/SdkSetup\Android.mk …
including development/apps/SettingInjectorSample\Android.mk …
including development/apps/WidgetPreview\Android.mk …
including development/apps/launchperf\Android.mk …
including development/host\Android.mk …
including development/tools/etc1tool\Android.mk …
including development/tools/line_endings\Android.mk …
including development/tools/mkstubs\Android.mk …
including packages/apps/ContactsCommon\Android.mk …
including packages/apps/Contacts\Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
Import includes file: out/host/windows-x86/obj/STATIC_LIBRARIES/libhost_intermed
iates/import_includes
host C: libhost <= build/libs/host\/CopyFile.c
build/libs/host/CopyFile.c:1:0: warning: -fPIC ignored for target (all code is p
osition independent) [enabled by default]
gcc.exe: warning: out/host/windows-x86/obj/STATIC_LIBRARIES/libhost_intermediate
s: linker input file unused because linking not done
Export includes file: build/libs/hostAndroid.mk — out/host/windows-x86/obj/STAT
IC_LIBRARIES/libhost_intermediates/export_includes
host StaticLib: libhost (out/host/windows-x86/obj/STATIC_LIBRARIES/libhost_inter
mediates/libhost.a)
Import includes file: out/host/windows-x86/obj/EXECUTABLES/acp_intermediates/imp
ort_includes
host C: acp /dev/null))
subdirs += \
# external/ant-glob \
# external/eclipse-windowbuilder/propertysheet \
# external/hamcrest \
# external/junit \
# sdk/apkbuilder \
# sdk/eclipse/scripts/rcp \
# sdk/testutils

subdirs += \
prebuilt \
prebuilts \
build/libs/host \
build/tools/zipalign \
dalvik/dexdump \
dalvik/libdex \
dalvik/tools/dmtracedump \
dalvik/tools/hprof-conv \
development/host \
development/tools/etc1tool \
development/tools/line_endings \
external/clang \
external/easymock \
external/expat \
external/gtest \
external/libcxx \
external/libcxxabi \
external/compiler-rt \
external/libpng \
external/llvm \
external/sqlite/dist \
external/zlib \
external/zopfli \
frameworks/base \
frameworks/compile \
frameworks/native \
frameworks/rs \
frameworks/tools \
system/core/adb \
system/core/fastboot \
system/core/libcutils \
system/core/liblog \
system/core/libsparse \
system/core/libziparchive \
system/core/libzipfile \
system/core/libutils \
system/extras/ext4_utils

subdirs += \
build/tools/signapk \
dalvik/dx \
libcore \
development/apps \
development/tools/mkstubs \
frameworks/compile/libbcc \
packages

Building Contacts.apk:

command make -C /d/Projects/Lollipop/platform -f build/core/main.mk out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk

out/target/product/generic/system/priv-app/Contacts/Contacts.apk: out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk | out/host/windows-x86/bin/acp out/target/product/generic/obj/NOTICE_FILES/src//system/priv-app/Contacts/Contacts.apk.txt

make: *** No rule to make target `out/host/windows-x86/bin/aapt.exe’, needed by
`out/target/common/obj/APPS/Contacts_intermediates/src/R.stamp’. Stop.
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

Copy existing aapt.exe from latest Android tools sdk to the directory.

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
target R.java/Manifest.java: Contacts (out/target/common/obj/APPS/Contacts_inter
mediates/src/R.stamp)
ERROR: resource directory ‘frameworks\support\v7\cardview\res’ does not exist
make: *** [out/target/common/obj/APPS/Contacts_intermediates/src/R.stamp] Error
1
make: Leaving directory `/d/Projects/Lollipop/platform’
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

#### make failed to build some targets (17 seconds) ####

Copy from:

We have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/sdk_v21_i
ntermediates/classes.jar’, needed by `out/target/common/obj/APPS/Contacts_interm
ediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

full_java_lib_deps := out/target/common/obj/JAVA_LIBRARIES/android.test.runner_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/com.android.contacts.common.test_intermediates/javalib.jar out/target/common/obj/APPS/Contacts_intermediates/classes.jar

including build/libs/host\Android.mk …
the full java libx
including build/tools/acp\Android.mk …
the full java libx
including build/tools/signapk\Android.mk …
the full java libx
including build/tools/zipalign\Android.mk …
the full java libx out/host/common/obj/JAVA_LIBRARIES/bouncycastle-host_interm
ediates/javalib.jar out/host/common/obj/JAVA_LIBRARIES/bouncycastle-bcpkix-host
_intermediates/javalib.jar
including development/apps/BluetoothDebug\Android.mk …
the full java libx out/host/common/obj/JAVA_LIBRARIES/bouncycastle-host_interm
ediates/javalib.jar out/host/common/obj/JAVA_LIBRARIES/bouncycastle-bcpkix-host
_intermediates/javalib.jar
including development/apps/BuildWidget\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/CustomLocale\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps\DevelopmentSettings\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/Development\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/Fallback\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates
/classes.jar
including development/apps/GestureBuilder\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/NinePatchLab\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/OBJViewer\Android.mk …
including development/apps/SdkSetup\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/SettingInjectorSample\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/WidgetPreview\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/apps/launchperf\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar
including development/host\Android.mk …
including development/tools/etc1tool\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar
including development/tools/line_endings\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar
including development/tools/mkstubs\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar
including packages/apps/ContactsCommon\Android.mk …
the full java libx out/host/common/obj/JAVA_LIBRARIES/asm-4.0_intermediates/ja
valib.jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.ja
r out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib
.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/java
lib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.
jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.ja
r out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib
.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/java
lib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.
jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.ja
r out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib
.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/java
lib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.
jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/c
lasses.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/classes.ja
r out/target/common/obj/APPS/com.android.contacts.common_intermediates/classes
.jar
including packages/apps/Contacts\Android.mk …
the full java libx out/target/common/obj/JAVA_LIBRARIES/android.test.runner_inte
rmediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates
/classes.jar out/target/common/obj/JAVA_LIBRARIES/com.android.contacts.common.t
est_intermediates/javalib.jar out/target/common/obj/APPS/com.android.contacts.c
ommon_intermediates/classes.jar
the full java libx out/target/common/obj/JAVA_LIBRARIES/sdk_v21_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/cl
asses.jar out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes
.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/javal
ib.jar out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javali
b.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar out
/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v7-cardview_intermediates/
javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v7-palette_int
ermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_
intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_i
ntermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_inte
rmediates/javalib.jar
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/sdk_v21_i
ntermediates/classes.jar’, needed by `out/target/common/obj/APPS/Contacts_interm
ediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’
./envsetup.sh: line 1704: out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk: No such file or directory

#### make failed to build some targets (17 seconds) ####

bash-3.1$

The sdk_v21 is the result of:

$(LOCAL_JAVA_LIBRARIES)

Which is from D:\Projects\Lollipop\platform\build\core\java.mk:

LOCAL_JAVA_LIBRARIES := sdk_v$(LOCAL_SDK_VERSION) $(LOCAL_JAVA_LIBRARIES)

Try copy Android.mk and CleanSpec.mk from:

To:

markerxy core-libart conscrypt okhttp core-junit bouncycastle ext

We have:

============================================
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/APPS/framework-res_inter
mediates/src/R.stamp’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/src/R.stamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (30 seconds) ####

# makefile (from `build/core/package_internal.mk’, line 303)
framework_res_package_export_deps := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

Perform some changes inside D:\Projects\Lollipop\platform\build\core\package_internal.mk:

useful command:

$(info the localsdkresy $(LOCAL_SDK_RES_VERSION))

Now we have:

including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/core-juni
t_intermediates/classes.jar’, needed by `out/target/common/obj/APPS/com.android.
contacts.common_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

out/target/common/obj/APPS/com.android.contacts.common_intermediates/classes-full-debug.jar: out/target/common/obj/JAVA_LIBRARIES/core-junit_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.jar out/target/common/obj/APPS/com.android.contacts.common_intermediates/src/R.stamp

Copy the required junit from platform/external/junit:

We have:

including external/junit/Android.mk …
the full java libx2 out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_inter
mediates/javalib.jar
the full java libx2 out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_inter
mediates/javalib.jar
the full java libx2 out/host/common/obj/JAVA_LIBRARIES/core-junit-hostdex_interm
ediates/javalib.jar out/host/common/obj/JAVA_LIBRARIES/core-libart-hostdex_inter
mediates/javalib.jar
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** external/junit: Invalid LOCAL_SDK_VERSION ‘4’ Choices
are: current 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (7 seconds) ####

Download version of 4 of local sdk, we have:

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/core-liba
rt_intermediates/classes.jar’, needed by `out/target/common/obj/JAVA_LIBRARIES/c
ore-junit_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Copy from:

We have:

including prebuilts/sdk/Android.mk …
make: *** No rule to make target `external/stlport/libstlport.mk’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

copy from:

https://android.googlesource.com/platform/external/stlport/+/android-5.1.1_r38

We have:

target Java: core-libart (out/target/common/obj/JAVA_LIBRARIES/core-libart_inter
mediates/classes)
cygwin warning:
MS-DOS style path detected: d:/Projects/Lollipop/platform
Preferred POSIX equivalent is: /cygdrive/d/Projects/Lollipop/platform
CYGWIN environment variable option “nodosfilewarning” turns off this warning.
Consult the user’s guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
sh: /cygdrive/c/Program Files (x86)/Java/jdk1.7.0_79/bin/javac: Argument list to
o long

Checking:

# makefile (from `build/core/definitions.mk’, line 1617)
define transform-java-to-classes.jar
@echo “target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))”
$(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
endef

target Java: core-libart (out/target/common/obj/JAVA_LIBRARIES/core-libart_inter
mediates/classes Compile with development/host/windows/prebuilt/javawrap.exe -J-
Xmx256m -source 1.7 -target 1.7 -Xmaxerrs 9999999 and parameter -bootclasspath o
ut/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar)
cygwin warning:

From command line we have:

D:\Projects\Lollipop\platform>bash
bash-3.1$ d:/Projects/Lollipop/platform/development/host/windows/prebuilt/javaw
rap.exe -J-Xmx256m -source 1.7 -target 1.7 -Xmaxerrs 9999999 -encoding UTF-8 -g
-bootclasspath out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/
classes.jar -extdirs “””” -d out/target/common/obj/JAVA_LIBRARIES/core-libart_i
ntermediates/classes -encoding UTF-8 -Xmaxwarns 9999999 @out/target/common/obj/
JAVA_LIBRARIES/core-libart_intermediates/classes/java-source-list-uniq
cygwin warning:
MS-DOS style path detected: d:/Projects/Lollipop/platform
Preferred POSIX equivalent is: /cygdrive/d/Projects/Lollipop/platform
CYGWIN environment variable option “nodosfilewarning” turns off this warning.
Consult the user’s guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
sh: /cygdrive/c/Program Files (x86)/Java/jdk1.7.0_79/bin/javac: Argument list to
o long

Uses javac.exe:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/ext_inter
mediates/classes.jar’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/classes-full-debug.jar’. Stop.

Problem starts at:

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar: out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/emma_out/lib/classes-jarjar.jar | out/host/windows-x86/bin/acp

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/emma_out/lib/classes-jarjar.jar: out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-jarjar.jar | out/host/windows-x86/bin/acp

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-jarjar.jar: out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-full-debug.jar | out/host/windows-x86/bin/acp

out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes-full-debug.jar: …

is generated via:

# commands to execute (from `build/core/java.mk’, line 345):
$(transform-java-to-classes.jar)

Where the classes.jar is malformed

But eventually changes inside D:\Projects\Lollipop\platform\build\core\definitions.mk:

Makes it work !

Remove the modifications LOCAL_SDK_RES_VERSION on D:\Projects\Lollipop\platform\build\core\package_internal.mk. And compile using:

subdir_makefiles := libcore/Android.mk external/junit/Android.mk frameworks/base/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

But we have:

/bin/bash: line 0: cd: frameworks/base/../../external/libphonenumber/java/src: N
o such file or directory
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:267: *** frameworks/base: Target java module does not define
any source or resource files. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Which cause by this logic in D:\Projects\Lollipop\platform\build\core\java.mk:

Causes by blank in:

need_compile_java := $(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES)$(filter true,$(LOCAL_SOURCE_FILES_ALL_GENERATED))

all_java_sources := $(subst ,, )

But let’s see if we try to resolve the find errors as in:

find: phone/java: No such file or directory
find: ../../external/apache-http/src/org/apache/http: No such file or directory
find: ../opt/telephony/src/java/android/provider: No such file or directory
find: ../opt/telephony/src/java/android/telephony: No such file or directory
find: ../opt/telephony/src/java/android/telephony/gsm: No such file or directory

find: ../opt/net/voip/src/java/android/net/rtp: No such file or directory
find: ../opt/net/voip/src/java/android/net/sip: No such file or directory
find: ../../external/apache-http/src/org/apache/http: No such file or directory
find: ../opt/telephony/src/java/android/provider: No such file or directory
find: ../opt/telephony/src/java/android/telephony: No such file or directory
find: ../opt/telephony/src/java/android/telephony/gsm: No such file or directory

find: ../opt/net/voip/src/java/android/net/rtp: No such file or directory
find: ../opt/net/voip/src/java/android/net/sip: No such file or directory
find: ../../frameworks/multidex/library/src: No such file or directory
find: ../../frameworks/multidex/instrumentation/src: No such file or directory
find: ../../external/apache-http/src/org/apache/http: No such file or directory
find: ../opt/telephony/src/java/android/provider: No such file or directory
find: ../opt/telephony/src/java/android/telephony: No such file or directory
find: ../opt/telephony/src/java/android/telephony/gsm: No such file or directory

find: ../opt/net/voip/src/java/android/net/rtp: No such file or directory
find: ../opt/net/voip/src/java/android/net/sip: No such file or directory
find: ../../external/nist-sip/java: No such file or directory
find: ../../external/apache-http/src: No such file or directory
find: ../../external/tagsoup/src: No such file or directory
find: ../../external/libphonenumber/java/src: No such file or directory
/bin/bash: line 0: cd: frameworks/base/../../external/libphonenumber/java/src: N
o such file or directory
the allx
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:267: *** frameworks/base: Target java module does not define
any source or resource files. Stop.

framework_docs_LOCAL_DROIDDOC_SOURCE_PATH := frameworks/base/core/java frameworks/base/graphics/java frameworks/base/location/java frameworks/base/media/java frameworks/base/media/mca/effect/java frameworks/base/media/mca/filterfw/java frameworks/base/media/mca/filterpacks/java frameworks/base/drm/java frameworks/base/opengl/java frameworks/base/sax/java frameworks/base/telecomm/java frameworks/base/telephony/java frameworks/base/phone/java frameworks/base/wifi/java frameworks/base/keystore/java frameworks/base/rs/java

FRAMEWORKS_BASE_SUBDIRS := core/java graphics/java location/java media/java media/mca/effect/java media/mca/filterfw/java media/mca/filterpacks/java drm/java opengl/java sax/java telecomm/java telephony/java phone/java wifi/java keystore/java rs/java

FRAMEWORKS_BASE_JAVA_SRC_DIRS := frameworks/base/core/java frameworks/base/graphics/java frameworks/base/location/java frameworks/base/media/java frameworks/base/media/mca/effect/java frameworks/base/media/mca/filterfw/java frameworks/base/media/mca/filterpacks/java frameworks/base/drm/java frameworks/base/opengl/java frameworks/base/sax/java frameworks/base/telecomm/java frameworks/base/telephony/java frameworks/base/phone/java frameworks/base/wifi/java frameworks/base/keystore/java frameworks/base/rs/java

Download from:

https://android.googlesource.com/platform/external/apache-http/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/opt/telephony/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/opt/net/voip/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/multidex/+/android-5.1.1_r38

https://android.googlesource.com/platform/external/nist-sip/+/android-5.1.1_r38

Now we have:

Clean step: rm -rf out/target/common/obj/JAVA_LIBRARIES/telephony-common_interme
diates
Clean step: rm -rf out/target/common/obj/JAVA_LIBRARIES/telephony-common_interme
diates
Clean step: rm -rf out/target/common/obj/JAVA_LIBRARIES/telephony-common_interme
diates
including frameworks/base/Android.mk …
find: ../../external/tagsoup/src: No such file or directory
find: ../../external/libphonenumber/java/src: No such file or directory
/bin/bash: line 0: cd: frameworks/base/../../external/libphonenumber/java/src: N
o such file or directory
including libcore/Android.mk …
including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/APPS/framework-res_inter
mediates/src/R.stamp’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/src/R.stamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/tagsoup/+/android-5.1.1_r38

https://android.googlesource.com/platform/external/libphonenumber/+/android-5.1.1_r38

But this time we still have:

including frameworks/base/Android.mk …
including libcore/Android.mk …
including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/APPS/framework-res_inter
mediates/src/R.stamp’, needed by `out/target/common/obj/APPS/Contacts_intermedia
tes/src/R.stamp’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Checking:

out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# Not a target:
out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp:

# makefile (from `build/core/package_internal.mk’, line 305)
framework_res_package_export_deps := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# makefile (from `frameworks/base/Android.mk’, line 415)
framework_res_R_stamp := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# makefile (from `build/core/package_internal.mk’, line 313)
all_library_res_package_export_deps := out/target/common/obj/APPS/framework-res_intermediates/src/R.stamp

# makefile (from `frameworks/base/Android.mk’, line 27)
framework_res_source_path := APPS/framework-res_intermediates/src

curious one:
let’s check whether it is executed.

D:\Projects\Lollipop\platform\frameworks\base\core\res\Android.mk(20):LOCAL_PACKAGE_NAME := framework-res

Let’s dump again the subdirs this time:

the subdirsx build/libs/host\Android.mk build/tools/acp\Android.mk build/tools/s
ignapk\Android.mk build/tools/zipalign\Android.mk development/apps\BluetoothDebu
g\Android.mk development/apps\BuildWidget\Android.mk development/apps\CustomLoca
le\Android.mk development/apps\DevelopmentSettings\Android.mk development/apps\D
evelopment\Android.mk development/apps\Fallback\Android.mk development/apps\Gest
ureBuilder\Android.mk development/apps\NinePatchLab\Android.mk development/apps\
OBJViewer\Android.mk development/apps\SdkSetup\Android.mk development/apps\Setti
ngInjectorSample\Android.mk development/apps\WidgetPreview\Android.mk developmen
t/apps\launchperf\Android.mk development/host\Android.mk development/tools/etc1t
ool\Android.mk development/tools/line_endings\Android.mk development/tools/mkstu
bs\Android.mk frameworks/base\Android.mk libcore\Android.mk packages\apps\Contac
tsCommon\Android.mk packages\apps\Contacts\Android.mk packages\apps\PhoneCommon\
Android.mk prebuilts\sdk\Android.mk

Modify:

subdir_makefiles := frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Now we have:

including frameworks/base/core/res/Android.mk …
including frameworks/base/Android.mk …
including libcore/Android.mk …
including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
target Export Resources: framework-res (out/target/common/obj/APPS/framework-res
_intermediates/package-export.apk)
/bin/bash: zip: command not found
make: *** [out/target/common/obj/APPS/framework-res_intermediates/package-export
.apk] Error 127
make: *** Deleting file `out/target/common/obj/APPS/framework-res_intermediates/
package-export.apk’
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (39 seconds) ####

Checking:

# commands to execute (from `build/core/package_internal.mk’, line 265):
@echo “target Export Resources: $(PRIVATE_MODULE) ($@)”
$(create-empty-package)
$(add-assets-to-package)

Download zip.exe from gnuwin32.

There’s some long process of java compilation, and then we arrive at:

target Java: ext (out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes
Compile with development/host/windows/prebuilt/javawrap.exe -J-Xmx256m -source
1.7 -target 1.7 -Xmaxerrs 9999999 and parameter -bootclasspath out/target/common
/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar on out/target/common/o
bj/APPS/ContactsTests_intermediates/classes-full-debug.jar )
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes-jarjar.j
ar
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/emma_out/lib/cla
sses-jarjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar
make: *** No rule to make target `out/host/windows-x86/bin/aidl.exe’, needed by
`out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/andr
oid/accessibilityservice/IAccessibilityServiceConnection.java’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

It’s easy, just copy the aidl.exe and it’s corresponding dlls from latest Android SDK’s build-tools to D:\Projects\Lollipop\platform\out\host\windows-x86\bin

Now we have:

logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/j
ava/android/content/EventLogTags.java <= frameworks/base/core/java/android/conte
nt/EventLogTags.logtags
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/j
ava/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/sp
eech/tts/EventLogTags.logtags
logtags: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/j
ava/android/webkit/EventLogTags.java <= frameworks/base/core/java/android/webkit
/EventLogTags.logtags
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/bouncycas
tle_intermediates/classes.jar', needed by `out/target/common/obj/JAVA_LIBRARIES/
framework_intermediates/classes-full-debug.jar'. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

#### make failed to build some targets (1.:17. (mm:ss)) ####

Download from:

https://android.googlesource.com/platform/external/bouncycastle/+/android-5.1.1_r38

Revise:

subdir_makefiles := external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Now we have:

============================================
including external/bouncycastle/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform'
build/core/java.mk:23: *** external/bouncycastle: Invalid LOCAL_SDK_VERSION '9'
Choices are: current 4 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

#### make failed to build some targets (8 seconds) ####

Just give it what it wants:

Download from:

https://android.googlesource.com/platform/prebuilts/sdk/+/android-5.1.1_r38/9/

We have:

make: Entering directory `/d/Projects/Lollipop/platform'
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/conscrypt
_intermediates/classes.jar', needed by `out/target/common/obj/JAVA_LIBRARIES/bou
ncycastle_intermediates/classes-full-debug.jar'. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

Download from:

https://android.googlesource.com/platform/external/conscrypt/+/android-5.1.1_r38

we have:

make: *** No rule to make target `out/host/windows-x86/framework/jarjar.jar', ne
eded by `out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-ja
rjar.jar'. Stop.

Checking:

out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-jarjar.jar: out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes-full-debug.jar external/conscrypt/jarjar-rules.txt | out/host/windows-x86/framework/jarjar.jar

# makefile (from `build/core/config.mk', line 406)
JARJAR := out/host/windows-x86/framework/jarjar.jar

Curious file in:

D:\Projects\Lollipop\platform\build\core\host_dalvik_java_library.mk(34):full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar

Modify subdir:

subdir_makefiles := build/core/host_dalvik_java_library.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

But we have:

including build/core/host_dalvik_java_library.mk …
make: Entering directory `/d/Projects/Lollipop/platform'
build/core/host_java_library_common.mk:42: *** : LOCAL_MODULE not defined before
call to local-intermediates-dir. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform'

revert subdir:

subdir_makefiles := build/core/host_dalvik_java_library.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Modify subdir:

subdir_makefiles := libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk libcore/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Download from:

https://android.googlesource.com/platform/external/jarjar/+/android-5.1.1_r38

Modify subdir:

subdir_makefiles := external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

But we have compile errors:

^
symbol: variable super
location: class KeepProcessor
100 errors
make: *** [out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/javalib.jar]
Error 41

Checking:

# commands to execute (from `build/core/host_java_library.mk', line 84):
$(transform-host-java-to-package)

define transform-host-java-to-package
@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
$(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH))
$(if $(PRIVATE_EXTRA_JAR_ARGS), $(call add-java-resources-to-package))
endef

out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/javalib.jar: external/jarjar/src/main/com/tonicsystems/jarjar/AbstractDepHandler.java

This is caused by unzip not found. But still we have the error.

Extracting the javac command line using procmon.exe we have:

javac.exe -encoding UTF-8 -g -classpath out/host/windows-x86/framework/jarjar-apache-ant.jar:out/host/windows-x86/framework/jarjar-maven-plugin-api.jar:out/host/common/obj/JAVA_LIBRARIES/jarjar-asm_intermediates/javalib.jar:out/host/common/obj/JAVA_LIBRARIES/jarjar-asm-commons_intermediates/javalib.jar -extdirs """" -d out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes @out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes/java-source-list-uniq

After detail checking, it is caused by invalid separator for -classpath in windows environment that should use:

javac.exe -encoding UTF-8 -g -classpath out/host/windows-x86/framework/jarjar-apache-ant.jar;out/host/windows-x86/framework/jarjar-maven-plugin-api.jar;out/host/common/obj/JAVA_LIBRARIES/jarjar-asm_intermediates/javalib.jar;out/host/common/obj/JAVA_LIBRARIES/jarjar-asm-commons_intermediates/javalib.jar -extdirs "" -d out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes @out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/classes/java-source-list-uniq

Now we have:

host Java: jarjar (out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/class
es)
/bin/bash: -c: line 1: syntax error: unexpected end of file
make: *** [out/host/common/obj/JAVA_LIBRARIES/jarjar_intermediates/javalib.jar]
Error 2
make: Leaving directory `/d/Projects/Lollipop/platform'

Sample make command for testing:

define transform-host-java-to-packagex
$(hide) if [ -s myTest1.txt ] ; then \
javac -classpath out\a;out\b \
fi
endef

For semi colon problem:

define transform-host-java-to-packagex
$(hide) if [ -s myTest1.txt ] ; then \
javac -classpath out\a\;out\b; \
fi
endef

Original normalize-path:

###########################################################
## Convert "a b c" into "a:b:c"
###########################################################
define normalize-path-list
$(subst $(space),:,$(strip $(1)))
endef

This is caused by use of semi colon without escape character. The routine normalize-path-list should be:

###########################################################
## Convert "a b c" into "a:b:c"
#$(subst $(space),:,$(strip $(1)))
###########################################################
define normalize-path-list
$(subst $(space),\;,$(strip $(1)))
endef

But caution, because it will break in Linux environment.

Now. let's go !

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors
make: *** [out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/class
es-full-debug.jar] Error 41
make: Leaving directory `/d/Projects/Lollipop/platform'

After performing some checking, it is found that the tgz file unzip using 7-zip is causing the truncated file names:

Using the tar command will alleviate the problem:

Report bugs to .

D:\temp>tar -xf test.tar

Now we have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/okhttp_in
termediates/classes.jar’, needed by `out/target/common/obj/JAVA_LIBRARIES/framew
ork_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/okhttp/+/android-5.1.1_r38

Now we have:

Copying: out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/emma_out/lib/
classes-jarjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar
make: *** No rule to make target `out/host/windows-x86/bin/rmtypedefs’, needed b
y `out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-deb
ug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Change the subdirs, now we have:

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/host/common/obj/JAVA_LIBRARIES/asm-tools_i
ntermediates/javalib.jar’, needed by `out/host/common/obj/JAVA_LIBRARIES/rmtyped
efs_intermediates/javalib.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/prebuilts/tools/+/android-5.1.1_r38/common/

Then modify:

subdir_makefiles := prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

After a rather long compilation process, we have:

Deleting out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes\an
droid\widget\NumberPicker$OnScrollListener$ScrollState.class
Deleting out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes\an
droid\widget\Toast$Duration.class
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-ja
rjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/emma_out/l
ib/classes-jarjar.jar
Copying: out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.ja
r
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/telephony
-common_intermediates/classes.jar’, needed by `out/target/common/obj/APPS/Contac
ts_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Compiled java program to be provided:

out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar
out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes.jar
out/target/common/obj/JAVA_LIBRARIES/com.android.vcard_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-common_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v13_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v7-cardview_intermediates/javalib.jar out/target/common/obj/JAVA_LIBRARIES/android-support-v7-palette_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/libphonenumber_intermediates/javalib.jar
out/target/common/obj/JAVA_LIBRARIES/libgeocoding_intermediates/javalib.jar

Revise subdir:

subdir_makefiles := frameworks/opt/telephony/Android.mk prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Download from:

https://android.googlesource.com/platform/frameworks/ex/+/android-5.1.1_r38

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
Aidl: telephony-common <= frameworks/opt/telephony/src/java/com/android/internal
/telephony/IIccPhoneBook.aidl
logtags: out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src
/src/java/com/android/internal/telephony/EventLogTags.java gzip -d test.tar.gz

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-c
ommon_intermediates/javalib.jar’, needed by `out/target/common/obj/APPS/Contacts
_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/frameworks/ex/+/android-5.1.1_r38

We have:

including frameworks/ex/common/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** frameworks/ex/common: Invalid LOCAL_SDK_VERSION ‘8’ C
hoices are: current 4 9 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/prebuilts/sdk/+/android-5.1.1_r38/8/

D:\Projects\Lollipop\platform\prebuilts\sdk\8>gzip -d test.tar.gz

D:\Projects\Lollipop\platform\prebuilts\sdk\8>tar -xf test.tar

After a long compilation process we have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/guava_int
ermediates/javalib.jar’, needed by `out/target/common/obj/APPS/Contacts_intermed
iates/classes-full-debug.jar’. Stop.

Download from:

https://android.googlesource.com/platform/external/guava/+/android-5.1.1_r38

https://android.googlesource.com/platform/frameworks/support/+/android-5.1.1_r38/v13

https://android.googlesource.com/platform/frameworks/support/+/android-5.1.1_r38/v7/

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/jsr305_in
termediates/javalib.jar’, needed by `out/target/common/obj/JAVA_LIBRARIES/guava_
intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/jsr305/+/android-5.1.1_r38

We have:

============================================
including frameworks/support/v13/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
build/core/java.mk:23: *** frameworks/support/v13: Invalid LOCAL_SDK_VERSION ’14
‘ Choices are: current 4 8 9 21. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download:

https://android.googlesource.com/platform/prebuilts/sdk/+/android-5.1.1_r38/14/

Download all of those sdk number.

We have now:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android_s
tubs_current_intermediates/classes.jar’, needed by `out/target/common/obj/JAVA_L
IBRARIES/android-support-v4-api22_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download:

https://android.googlesource.com/platform/external/doclava/+/android-5.1.1_r38

make: Entering directory `/d/Projects/Lollipop/platform’
make: *** No rule to make target `out/host/windows-x86/framework/antlr-runtime.j
ar’, needed by `out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/javalib
.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

Download:

https://android.googlesource.com/platform/external/antlr/+/android-5.1.1_r38

https://android.googlesource.com/platform/external/jsilver/+/android-5.1.1_r38

make: *** No rule to make target `out/host/common/obj/JAVA_LIBRARIES/tagsouplib_
intermediates/javalib.jar’, needed by `out/host/common/obj/JAVA_LIBRARIES/doclav
a_intermediates/javalib.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

external\doclava\src\com\google\doclava\ClassInfo.java:20: error: package com.sun.javadoc does not exist
import com.sun.javadoc.ClassDoc;

This is caused by malformed path to the tools.jar in java path. The command line should be like this:

javac.exe -encoding UTF-8 -g -classpath out/host/windows-x86/framework/antlr-runtime.jar;out/host/windows-x86/framework/guavalib.jar;out/host/windows-x86/framework/jsilver.jar;out/host/common/obj/JAVA_LIBRARIES/tagsouplib_intermediates/javalib.jar;c:\Progra~2\Java\jdk1.7.0_80\lib\tools.jar -extdirs “” -d out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/classes @out/host/common/obj/JAVA_LIBRARIES/doclava_intermediates/classes/java-source-list-uniq

Perform revision in:

D:\Projects\Lollipop\platform\build\core\config.mk

HOST_JDK_TOOLS_JAR:= c:/Progra~2/Java/jdk1.7.0_80/lib/tools.jar

We have:

Install: out/host/windows-x86/framework/doclava.jar
Aidl Preprocess: out/target/common/obj/framework.aidl
Docs droiddoc: out/target/common/docs/api-stubs

After some long compilation process, we have:

Install: out/host/windows-x86/framework/doclava.jar
Aidl Preprocess: out/target/common/obj/framework.aidl
Docs droiddoc: out/target/common/docs/api-stubs
Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: Leaving directory `/d/Projects/Lollipop/platform’

Change inD:\Projects\Lollipop\platform\build\core\droiddoc.mk:

-J-Xmx512m

We have:

make: Entering directory `/d/Projects/Lollipop/platform’
Docs droiddoc: out/target/common/docs/api-stubs
javadoc: error – Cannot find doclet class com.google.doclava.Doclava
1 error
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: Leaving directory `/d/Projects/Lollipop/platform’

This again, is caused by invalid separator as in:

javadoc.exe -encoding UTF-8 @out/target/common/obj/JAVA_LIBRARIES/api-stubs_intermediates/droiddoc-src-list -J-Xmx512m -XDignore.symbol.file -quiet -doclet com.google.doclava.Doclava -docletpath out/host/windows-x86/framework/jsilver.jar:out/host/windows-x86/framework/doclava.jar -templatedir build/tools/droiddoc/templates-sdk -htmldir frameworks/base/docs/html -bootclasspath out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar -classpath out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes.jar: -sourcepath frameworks/base/core/java;frameworks/base/graphics/java;frameworks/base/location/java;frameworks/base/media/java;frameworks/base/media/mca/effect/java;frameworks/base/media/mca/filterfw/java;frameworks/base/media/mca/filterpacks/java;frameworks/base/drm/java;frameworks/base/opengl/java;frameworks/base/sax/java;frameworks/base/telecomm/java;frameworks/base/telephony/java;frameworks/base/phone/java;frameworks/base/wifi/java;frameworks/base/keystore/java;frameworks/base/rs/java:out/target/common/obj/JAVA_LIBRARIES/bouncycastle_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/conscrypt_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/okhttp_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/voip-common_intermediates/classes.jar: -d out/target/common/docs/api-stubs -hdf page.build LMY49M-eng..20170619.162734 -hdf page.now “”19 Jun 2017 16:29″” -knowntags ./frameworks/base/docs/knowntags.txt -hidePackage com.android.org.conscrypt -since prebuilts/sdk/api/1.xml 1 -since prebuilts/sdk/api/2.xml 2 -since prebuilts/sdk/api/3.xml 3 -since prebuilts/sdk/api/4.xml 4 -since prebuilts/sdk/api/5.xml 5 -since prebuilts/sdk/api/6.xml 6 -since prebuilts/sdk/api/7.xml 7 -since prebuilts/sdk/api/8.xml 8 -since prebuilts/sdk/api/9.xml 9 -since prebuilts/sdk/api/10.xml 10 -since prebuilts/sdk/api/11.xml 11 -since prebuilts/sdk/api/12.xml 12 -since prebuilts/sdk/api/13.xml 13 -since prebuilts/sdk/api/14.txt 14 -since prebuilts/sdk/api/15.txt 15 -since prebuilts/sdk/api/16.txt 16 -since prebuilts/sdk/api/17.txt 17 -since prebuilts/sdk/api/18.txt 18 -since prebuilts/sdk/api/19.txt 19 -since prebuilts/sdk/api/20.txt 20 -since prebuilts/sdk/api/21.txt 21 -werror -hide 111 -hide 113 -overview frameworks/base/core/java/overview.html -hdf sdk.version 4.4 -hdf sdk.rel.id 1 -hdf sdk.preview 0 -stubs out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/src -api out/target/common/obj/PACKAGING/public_api.txt -removedApi out/target/common/obj/PACKAGING/removed.txt -nodocs

c:\Progra~2\Java\jdk1.7.0_80\bin\javadoc.exe -encoding UTF-8 @out/target/common/obj/JAVA_LIBRARIES/api-stubs_intermediates/droiddoc-src-list -J-Xmx512m -XDignore.symbol.file -quiet -doclet com.google.doclava.Doclava -docletpath out/host/windows-x86/framework/jsilver.jar

Perform necessary modifications in D:\Projects\Lollipop\platform\build\core\droiddoc.mk:

$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX)\;$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CLASSPATH := $(subst $(space),\;,$(full_java_libs))

But still we have:

Docs droiddoc: out/target/common/docs/api-stubs
javadoc: error – Cannot find doclet class com.google.doclava.Doclava
1 error
out/host/windows-x86/framework/doclava.jar: out/host/windows-x86/framework/docla
va.jar: cannot execute binary file
make: *** [out/target/common/docs/api-stubs-timestamp] Error 45
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (3.:57. (mm:ss)) ####

Perform some modifications to D:\Projects\Lollipop\platform\build\core\droiddoc.mk.

Now we have:

including external/junit/Android.mk …
including packages/apps/ContactsCommon/Android.mk …
including packages/apps/Contacts/Android.mk …
including prebuilts/sdk/Android.mk …
make: Entering directory `/d/Projects/Lollipop/platform’
Docs droiddoc: out/target/common/docs/api-stubs
DroidDoc took 17 sec. to write docs to out/target/common/docs/api-stubs
make: Leaving directory `/d/Projects/Lollipop/platform’

still we have:

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android_s
tubs_current_intermediates/classes.jar’, needed by `out/target/common/obj/JAVA_L
IBRARIES/android-support-v4-api22_intermediates/classes-full-debug.jar’. Stop.

android_stubs_current_intermediates

Revise subdir:

subdir_makefiles := development/build/Android.mk external/tagsoup/Android.mk external/antlr/Android.mk external/jsilver/Android.mk external/doclava/Android.mk frameworks/support/v13/Android.mk frameworks/support/v4/Android.mk frameworks/support/v7/cardview/Android.mk external/jsr305/Android.mk external/guava/Android.mk frameworks/ex/common/Android.mk frameworks/opt/vcard/Android.mk frameworks/opt/net/voip/Android.mk frameworks/opt/net/ims/Android.mk frameworks/opt/telephony/Android.mk prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

Now we have:

make: Entering directory `/d/Projects/Lollipop/platform’
Compiling SDK Stubs: out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_
intermediates/classes.jar
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-s
upport-annotations_intermediates/javalib.jar’, needed by `out/target/common/obj/
JAVA_LIBRARIES/android-support-v4-donut_intermediates/classes-full-debug.jar’.
Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

android-support-annotations

Modify subdir.

Now we have:

target Java: android-support-v4 (out/target/common/obj/JAVA_LIBRARIES/android-su
pport-v4_intermediates/classes Compile with javac -J-Xmx256m -source 1.7 -target
1.7 -Xmaxerrs 9999999 and parameter -bootclasspath out/target/common/obj/JAVA_L
IBRARIES/sdk_v4_intermediates/classes.jar on out/target/common/obj/APPS/Contacts
Tests_intermediates/classes-full-debug.jar )
frameworks\support\v4\java\android\support\v4\accessibilityservice\Accessibility
ServiceInfoCompat.java:106: error: cannot find symbol
return AccessibilityServiceInfoCompatJellyBeanMr2.getCapabilities(in
fo);
^
symbol: variable AccessibilityServiceInfoCompatJellyBeanMr2
location: class AccessibilityServiceInfoJellyBeanMr2
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
make: *** [out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates
/classes-full-debug.jar] Error 41
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (1.:26. (mm:ss)) ####

bash-3.1$

out/target/common/obj/JAVA_LIBRARIES/android-support-v4_intermediates/classes-full-debug.jar

This is caused by malformed file name again:

redownload and extract with gzip and tar command line, we have:

target Static Jar: android-support-v7-cardview (out/target/common/obj/JAVA_LIBRA
RIES/android-support-v7-cardview_intermediates/javalib.jar)
make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/android-s
upport-v7-palette_intermediates/javalib.jar’, needed by `out/target/common/obj/A
PPS/Contacts_intermediates/classes-full-debug.jar’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

out/target/common/obj/JAVA_LIBRARIES/android-support-v7-palette_intermediates/javalib.jar

Revise subdir:

subdir_makefiles := frameworks/support/v7/palette/Android.mk frameworks/support/annotations/Android.mk development/build/Android.mk external/tagsoup/Android.mk external/antlr/Android.mk external/jsilver/Android.mk external/doclava/Android.mk frameworks/support/v13/Android.mk frameworks/support/v4/Android.mk frameworks/support/v7/cardview/Android.mk external/jsr305/Android.mk external/guava/Android.mk frameworks/ex/common/Android.mk frameworks/opt/vcard/Android.mk frameworks/opt/net/voip/Android.mk frameworks/opt/net/ims/Android.mk frameworks/opt/telephony/Android.mk prebuilts/tools/common/guava-tools/Android.mk prebuilts/tools/common/asm-tools/Android.mk development/tools/rmtypedefs/Android.mk external/okhttp/Android.mk external/jarjar/Android.mk libcore/Android.mk external/conscrypt/Android.mk external/bouncycastle/Android.mk frameworks/base/core/res/Android.mk frameworks/base/Android.mk external/junit/Android.mk packages/apps/ContactsCommon/Android.mk packages/apps/Contacts/Android.mk prebuilts/sdk/Android.mk

We have:

Copying: out/target/common/obj/APPS/Contacts_intermediates/classes-jarjar.jar
Copying: out/target/common/obj/APPS/Contacts_intermediates/emma_out/lib/classes-
jarjar.jar
Copying: out/target/common/obj/APPS/Contacts_intermediates/classes.jar
make: *** No rule to make target `external/proguard/bin/proguard.sh’, needed by
`out/target/common/obj/APPS/Contacts_intermediates/proguard.classes.jar’. Stop.

make: Leaving directory `/d/Projects/Lollipop/platform’

Download from:

https://android.googlesource.com/platform/external/proguard/+/android-5.1.1_r38

We have:

Proguard: out/target/common/obj/APPS/Contacts_intermediates/proguard.classes.jar

ProGuard, version 4.10
Reading input…
Reading program jar [D:\Projects\Lollipop\platform\out\target\common\obj\APPS\Co
ntacts_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\core-junit_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\core-libart_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\ext_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\framework_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\telephony-common_intermediates\classes.jar]
Reading library jar [D:\Projects\Lollipop\platform\out\target\common\obj\JAVA_LI
BRARIES\voip-common_intermediates\classes.jar]
Initializing…
Ignoring unused library classes…
Original number of library classes: 11333
Final number of library classes: 11333
Shrinking…
Removing unused program classes and class elements…
Original number of program classes: 3195
Final number of program classes: 1222
Writing output…
Preparing output jar [D:\Projects\Lollipop\platform\out\target\common\obj\APPS\C
ontacts_intermediates\proguard.classes.jar]
Copying resources from program jar [D:\Projects\Lollipop\platform\out\target\c
ommon\obj\APPS\Contacts_intermediates\classes.jar]
make: *** No rule to make target `out/host/windows-x86/bin/dx’, needed by `out/t
arget/common/obj/APPS/Contacts_intermediates/with-local/classes.dex’. Stop.
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make failed to build some targets (56 seconds) ####

bash-3.1$

Download from:

https://android.googlesource.com/platform/dalvik/+/android-5.1.1_r38

make: Entering directory `/d/Projects/Lollipop/platform’
host Java: dx (out/host/common/obj/JAVA_LIBRARIES/dx_intermediates/classes)
warning: [options] bootstrap class path not set in conjunction with -source 1.6
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 warning
Install: out/host/windows-x86/framework/dx.jar
Copy: dx (out/host/windows-x86/obj/EXECUTABLES/dx_intermediates/dx)
Notice file: dalvik/dx/NOTICE — out/host/windows-x86/obj/NOTICE_FILES/src//bin/
dx.txt
Install: out/host/windows-x86/bin/dx
target Dex: Contacts
Copying: out/target/common/obj/APPS/Contacts_intermediates/classes.dex
make: *** No rule to make target `out/host/windows-x86/framework/signapk.jar’, n
eeded by `out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk
‘. Stop.

We have:

target Package: Contacts (out/target/product/generic/obj/APPS/Contacts_intermedi
ates/package.apk)
warning: string ‘add_field’ has no default translation.
warning: string ‘add_field’ is missing 87 required localizations: af_ZA am_ET ar
_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_C
A en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE
fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL ja
_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_I
N ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK
sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ vi
_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘contact_detail_picture_description’ has no default translation.

warning: string ‘contact_detail_picture_description’ is missing 87 required loca
lizations: af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_
DE de_LI el_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE
eu_ES fa_IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID i
s_IS it_CH it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_
LV mk_MK ml_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT
rm_CH ro_RO ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH t
r_TR uk_UA ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘contactsAllLabel’ has no default translation.
warning: string ‘contactsAllLabel’ is missing 87 required localizations: af_ZA a
m_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_
AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI
fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT i
w_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_
MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU
si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK u
z_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘contactsGroupsLabel’ has no default translation.
warning: string ‘contactsGroupsLabel’ is missing 87 required localizations: af_Z
A am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR
en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi
_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_I
T iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN
mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru
_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_P
K uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘description_dial_phone_number’ has no default translation.
warning: string ‘description_dial_phone_number’ is missing 87 required localizat
ions: af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de
_LI el_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_E
S fa_IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS
it_CH it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk
_MK ml_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_C
H ro_RO ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR
uk_UA ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘description_send_message’ has no default translation.
warning: string ‘description_send_message’ is missing 87 required localizations:
af_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI e
l_GR en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_
IR fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH
it_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK m
l_IN mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_
RO ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA
ur_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘no_contact_details’ has no default translation.
warning: string ‘no_contact_details’ is missing 87 required localizations: af_ZA
am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR e
n_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_
FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT
iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN m
n_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_
RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK
uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘people’ has no default translation.
warning: string ‘people’ is missing 87 required localizations: af_ZA am_ET ar_EG
az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_CA e
n_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE fr_
CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL ja_JP
ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_IN m
s_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK sk_
SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ vi_VN
zh_CN zh_HK zh_TW zu_ZA
warning: string ‘percentage’ has no default translation.
warning: string ‘percentage’ is missing 87 required localizations: af_ZA am_ET a
r_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR en_AU en_
CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR fi_FI fr_BE
fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_IT iw_IL j
a_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN mn_MN mr_
IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO ru_RU si_LK
sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_PK uz_UZ v
i_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘use_photo_as_primary’ has no default translation.
warning: string ‘use_photo_as_primary’ is missing 87 required localizations: af_
ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_GR
en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR f
i_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it_
IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_IN
mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO r
u_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur_
PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
warning: string ‘viewContactDesription’ has no default translation.
warning: string ‘viewContactDesription’ is missing 87 required localizations: af
_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_G
R en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR
fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it
_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_I
N mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO
ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur
_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
/bin/bash: /c/Progra~2/Java/jdk1.7.0_80/bin/jar: Bad file number
make: *** [out/target/product/generic/obj/APPS/Contacts_intermediates/package.ap
k] Error 126
make: *** Deleting file `out/target/product/generic/obj/APPS/Contacts_intermedia
tes/package.apk’
make: Leaving directory `/d/Projects/Lollipop/platform’

out/target/product/generic/obj/APPS/Contacts_intermediates/package.apk:

Error is located at:

$(add-carried-java-resources)

The proper command is:

D:\Projects\Lollipop\platform>jar uf out/target/product/generic/obj/APPS/Contact
s_intermediates/package.apk out/target/product/generic/obj/APPS/Contacts_interme
diates/java_res_jar_flags

Modify D:\Projects\Lollipop\platform\build\core\definitions.mk

At last we have:

warning: string ‘viewContactDesription’ has no default translation.
warning: string ‘viewContactDesription’ is missing 87 required localizations: af
_ZA am_ET ar_EG az_AZ bg_BG bn_BD ca_ES cs_CZ da_DK de_AT de_CH de_DE de_LI el_G
R en_AU en_CA en_GB en_IN en_NZ en_SG en_US eo_EU es_ES es_US et_EE eu_ES fa_IR
fi_FI fr_BE fr_CA fr_CH fr_FR gl_ES hi_IN hr_HR hu_HU hy_AM in_ID is_IS it_CH it
_IT iw_IL ja_JP ka_GE kk_KZ km_KH kn_IN ko_KR ky_KG lo_LA lt_LT lv_LV mk_MK ml_I
N mn_MN mr_IN ms_MY my_MM nb_NO ne_NP nl_BE nl_NL pl_PL pt_BR pt_PT rm_CH ro_RO
ru_RU si_LK sk_SK sl_SI sr_RS sv_SE sw_TZ ta_IN te_IN th_TH tl_PH tr_TR uk_UA ur
_PK uz_UZ vi_VN zh_CN zh_HK zh_TW zu_ZA
make: Leaving directory `/d/Projects/Lollipop/platform’

#### make completed successfully (59 seconds) ####

Bootstrap Dialog Table Look Up Example

May 10, 2017

Here is the table look up example in action. When the page is properly setup it will show one button as follows:

When the button is clicked it will show the look up dialog box:

The data is retrieved from the server using AJAX based on user action, such as a click on table header, etc. The table is actually the extension of the original jQuery.DataTable.js open source program.

The table can be dynamically built using SELECTOR keyword:

The programmer only responsible for performing the codes inside the server side ASPX handler for given selector keyword, such as table header definition, paging request and display data. This is included in the sample NewInquiry.aspx page.

User can hover to the table and perform selection by clicking on to the table, and it will show the alert box:

This sample program is created using ASP.NET, so if you are interested to see how this page in action, there are several pre-requisite as follows:

1. The data source is using SQL Server 2005
2. Windows Server 2003 or higher with Framework 4

Sample data is included in the “data” folder on the source package.

Source files and supporting executable as follows:

https://github.com/surya-rakanta/BootstrapLookUp.git

How to Decompile MultiCharts SEF File

March 21, 2017

This article will explore whether it is possible to perform decompilation of MultiCharts’ *.SEF file back to its original Power Language Script, a variant of Easy Language Script. This is one of trading applications just like TradeStation.

The *.SEF file is created by using the “Export Read Only” menu in MultiCharts Power Language Editor (PLEdit.exe). At first glance, the content of generated file consist some header information and the actual executable file.

Let’s find whether the editor is keeping the Intermediate code, or hopefully an encrypted source code just like TradeStation’s *.ELD file.

This is done by creating an increasing more complex script and see the changes inside the *.SEF file. So, after several steps of creating, compiling and examining the file content, I realized that the PLEdit program is in fact, do not try to preserve the intermediate code, let alone the encrypted source code.

The only information is the actual executable file that is located just after the header portion of the file which typically like this:

There’s a MZ signature that denotes that portion of the block to the end of *.SEF file is actually the executable file. Using the Hex Editor I can move out the block into separate file and try to dissasemble it:

This executable file is actually a form of a DLL file because it has some exported functions, one of which is called “Create”. When I try to execute the compiled script in MultiCharts program by using the “Insert Study …” menu, it will try to load the generated i_myTesting.dll.

The myTesting is the is the name that I declared when creating the script of type Indicator (hence the i_ prefix). This is evident by viewing the Load DLL output from WinDBG program:

When “Insert Study…” is executed for myTesting script, the program will call the DLL’s Create exported function.

So, I landed on a rather hopeless case of machine code that only the computer’s CPU and MultiCharts program can execute faithfully. At this point, I try to googling out for this issue. I found that certain website does actually stated that they can decompile manually from the machine code to the script source code.

I try to communicate with one of the support of this service, and get a positive response, that indeed, yes, they can decompile and it require about 3 or 4 weeks and some compensation.

How can they do that ? This let me pause and think, maybe I do not perform a more in depth analysis. Then I have another activities to perform, but the question remains in my head. It’s like they can provide something from nothing.

So, I decided to take a more close look, by try to identify how the PLEditor generate it’s DLL file from the script. I created the most simple Indicator script called myTesting and it’s content as follows:

Then I realized that the PLEditor.exe, actually compile it’s file by using the process called StudyServer.exe.

By examining the modules loaded by StudyServer.exe, I’ve found the curious file called GccWrapServer.dll. By examining more closely, it is revealed that it is actually a COM object and it has a methods called Compile and SetCompilerSettings method. This is evident by viewing its type library using OLE View program:

From the above picture, I can see that the Compile method accepts the CPP file name and generated DLL file name. By setting the breakpoint into the Compile method, what I get from these two parameter as follows:

From the above execution code, I can see that the ecx register contains the CPP file name:

Folder content as follows:

After the Compile finishes, the *.cpp file is removed, so I try to obtained it while the program is suspended by the debugger and the content of CPP file as follows:

There are many information revealed by this generated CPP and its corresponding *.o file, one is the parameter information. So the above Create export function calls can be identified as follows:

The above rather hopeless code starts to have some meaning, while it is just a start, then the decompilation of MultiChart’s *.SEF file suddenly become possible. Much works still to be done, it’s hard, but it is indeed possible 🙂

Open Office’s Open XML SDK Saving Issue

September 9, 2016

In one of the projects that involved using the Open XML SDK for manipulating the spreadsheet files, I stumbles across some strange issue, i.e. some of the modified worksheet cell items is not get saved into the document.

I’ve spend considerable amount time to investigate this, which involved obtaining the existing source of SDK, resolves compilation issue and examine the save routine.

By examining the workings of save method inside the SDK, I figured out, that although I’ve called PutXDocument and examine the XML result inside the sheets*.xml the data is already saved, but actually there’s another layer inside the Worksheet object that still contains old worksheet data.

So, when the Close method of SpreadsheetDocument is called, it is the layer of original worksheet data that get saved into the OpenXmlPart stream, not the stream that I already modified.

Try to call Worksheet.Save method proves to be useless, because the Close method is actually use the same method when try to save all Open Xml Parts.

So, how to trigger the data flow from the modified Xml data layer back to Worksheet object ? You can use Worksheet.Reload method. This call will cause your modified Xml part flows back into the Worksheet object.

So, at this time, when you try to call the Close method of the SpreadsheetDocument, your XML layer already get saved into the Worksheet object and your modified data inside the Worksheet object will take effect.

Resolving XAOS Post Compilation Issues

September 9, 2016

When I try to load the *.xpf file containing the user formula, my compiled application refuses to process it:

zp01

Seems that the previous complaint from configuration process at the compile time should be taken seriously.

Let’s now handle the importing of the GSL library. GSL stands for GNU Science Library, and it is in the form of source code and should be compiled first to obtain the library specific to the OS of the target machine.

zp02

Examining the content of the above include files that causes a problem reveal that it is created as symbolic link statement to the actual file. There is a statement inside makefile.am file configuration inside D:\Projects\Fractal\gsl\gsl folder as follows:

zp03

In configure file:

zp04

MSYS can’t handle the symlink, so the solution is revise the above script to use cp (copy command) instead of ln -s. Make sure it does so in the config.log file:

zp05

Now GSL source will continue to compile until it stops at this stage:

zp06

This is because:

zp07

Some stage of previous compilation process is not executed due to some unknown problem, just remove *.lo and recompile inside utils folder:

zp08

Now GNU GSL Library will compile just file. Let’s move on to re-compile XAOS source:

zp09

There is a problem inside the configuration file inside the XAOS source file that causes GSL_CONFIG to be blank when the script try to check and include the GSL library, so modify to:

zp10

Depending on the location of GSL library installation. Now we have:

zp11

Copy the include file from GNU gsl folder into src\include of the XAOS source code and also the corresponding libgsl.a and libgslcblas.a to C:\mingw\lib folder.

Open XAOS program and try to load *.xpf file that has formula in it and the program crashes 🙂

Further examination reveals that I’ve used the wrong GSL library for compiling GSL with XAOS. This is verified by creating the small program and examine the data, and it turns out the result is garbage, although it compiles right.

The compiled static library libgsl.a should be taken from .libs result in the GSL directory, not from lib folder.

Re-compile XAOS after the correct library is copied.

Now, user formula runs just fine 🙂

XAOS Compilation on Windows OS

September 2, 2016

XAOS application is used to display fractal graphics, and because I want to perform close examination of the way it process the given user formula, I try to compile from the source on windows OS.

This article describe the compilation process and resolves the common issues found in compilation process on windows OS.

xa01

Since it is still a warning stage, I decided to leave it for a while and proceed to the next phase of compilation process.

xa02

The file libfilter.a is actually generated from the compiler, seems it failed to manifest at compile phase previous to linking process.

xa03

It failed to manifest because there is an error above. Download the appropriate libiconv library from MINGW site.

xa04

This is because of the problems of missing libiconv that get passed at configuration process. Remove all object files and intermediate result of compilation process, and perform re-configure.

This time, the compilation is progressing without any incident.

xa05

How to Resolve ClosedXML Error

August 24, 2016

One of my projects requires capability to create and download pre-formatted excel file to the web client. In the process of finding the suitable application packages that will handle this task, I’ve found ClosedXML utility that seems to fulfill this demand. It is also an open source application which has some advantage of cost reduction 🙂

So, I decided to perform some assessment of this software before deploy it to production stage. I’ve created my template excel file, save it in the Open XML format.

After passing several feature testing, I stop at an obscure error trying to perform copy method of the excel worksheet:

ox01

The error says “Sequence contains no matching element”. To isolate the problem, the routine is moved to desktop application. After that I obtain and compile the source code of ClosedXML application.

The debugging result as follows:

ox02

The application crashes when trying to enumerate existing ranges called “_Regression_Int” and the Ranges object throws exception because it points to non existent physical range. I don’t recall creates this weird range name, it must be an artifact of previous version of office application or there are some flaws in name creation routine.

The Open XML format is actually consist of compressed files, so I decided to decompress and examine the Workbook.xml inside the folder as follows:

ox03

There’s a range definition but there are no actual range object, so I decided to remove this pesky thing, and perform compression again. This time, the worksheet can be copied without any error.

The Sims FreePlay’s Way of Text Rendering

February 6, 2016

Gamers that plays the Sims FreePlay Android application will be familiar with the start up screen below:

sf01

Here it will show the constant message “LOADING…” and the varying message inside the blue box, which different each time when you start the application. Seems that this message is generated using some sort of random mechanism.

The actual string lies inside thesimsfreeplay_android.sb depending on the language setting of the device, and it is governed by STRING_LOADING_TICKER_XX records where XX denotes the sequence ranging from 00 to 21.

So, after the random module generates the sequence number, say 11, actually this is for “Earn big XP bonuses for reaching relationship milestones” above. This string will be retrieved and displayed on the GL Surface.

The text itself is rendered dynamically using glTexSubImage2D and it is placed on empty space of size 1024×64 texel inside existing texture channel. Each unique character to be rendered is generated on the existing texture memory as follows:

sf02

Because of the the texture memory is in inverted form, so to you can either flip the monitor to see the character or use the vertical rotation to view each of the character as follows:

sf03

Then, it is a matter of placing the right vertex position for each character to be rendered on to GL Surface.

The Sims FreePlay’s SBIN File Format

January 1, 2016

One of the data structures used in Sims FreePlay android game application is files with *.sb extention.

If you try to open it in the hex editor, you will find that it is started with SBIN signature, followed by other blocks of data, started with with other signature, such as STRU, FIEL, ENUM, OHDR, DATA, etc.

Apparently the 4 bytes signature is the marker for the block of data, and close examination will reveal that each block has 3 common data type which I will call the signature, block length and the checksum.

Let’s take the STRU block below for some illustration. This is taken from one of the *.sb file called locales.sb as follows:

sb01

From the above picture, each block contains 3 (three) data item, each of 4 bytes size. The first one (red box) is the signature, here the 0x53545255 is STRU, the second one (blue box) is size of the data inside of this block in bytes, here the size is 0x0C, the third (green box) is some kind of checksum value of the data block.

If you try to change just one byte of the data portion, the checksum value will be different and it is up to the game developer here what to do when this condition occurs, for example, it will only show blank data for some text information.

By reading the signatures block, you may get some idea what data that is contained in the file. It should contain structure, fields, field names, and the actual data.

So, how to describe each block into structures, fields, header name and data ?

Let’s examine the data portion of STRU block as follows:

sb02

The size of each STRU data is 6 (six) bytes, and from the above example it contains 2 (two) structures, and apparently contain 3 (three) data types, each has the size of 2 (two) bytes.

Take the first structure information (red box), the second item is used to determine the location of the field and the third item is total field number in the structure.

So, for the first structure (red box), the field location is 0x0000, this is multiplied by 0x8 which is the size of field data block to get the pointer position if first field data. From the information of third data item, the first structure has 2 fields, i.e. 0x0002.

The field information of second structure (blue box) is located at offset 0x0002 times 0x8 which is 0x10, and it has 0x0009 or 9 fields.

To determine the pointer location of fields information, just add the offset with the starting of the data portion of the FIEL block which is just after 4 bytes checksum. This is illustrated by the picture below:

sb03

For the above sample, the start of field data block is located at offset 0x38, and each has the size of 8 (eight) bytes as denoted by red box. This is the first field of first structure.

To determine the first field of second structure, from the above calculation, the offset 0x38 should be added with 0x10 and we arrive at:

sb04

As denotes by blue box, this is the first field of second structure. And the field information contains the 2 bytes field sequence followed by another 2 bytes that denotes the field type. The field type will determine how the structure reader obtained the data for each field.

Take the first field inside first structure, the field sequence number is 0x0002. This sequence is related to the data portion inside CHDR structure, which is used to determine the field name.

Below is the picture of CHDR structure:

sb05

The 0x43484452 (CHDR) actually the signature, it has 0x198 bytes length and 0x4A35B08C is checksum value for the data block. After the check some, here comes the CHDR detail structure, which each has 8 (eight) bytes.

From the above picture, the red box is for sequence zero, blue box is sequence 1 (one) and so on. You can see that sequence 0 (zero) contains no information. The first information actually resides on second record (blue box) which is sequence 1.

Each CHDR detail structure consists of 4 bytes that denotes offset location of the field name inside CDAT structure, and 4 bytes that denotes field name length.

Take the offset location of sequence 1 which is 0x00000001. This value is added to the start of data portion of CDAT to get the name of the sequence.

Below is picture of CDAT structure:

sb06

From the above sample, the 0x43444154 (CDAT) is signature, followed by 4 bytes length (0x00000195) and 4 bytes checksum (0x4FD442C6), so we arrive at offset 0x384 as the start position of field names information. This is added by 0x01 obtained from CHDR structure, and we arrived at offset 0x385, and by the 0x08 bytes as its length, we get the field name information (red box) which is “Language”.

So, what’s the name of field sequence 0x02 and 0x03 ? The answer is “languageid” and “localeid”. I will leave the task to derive this conclusion for the reader 🙂

The combination of bytes inside OHDR and DATA block is used to locate the detail records for each table. Below is the part of OHDR structure:

sb07

The value 0x4F484452 is OHDR signature, it has 0x0C length, and just after the check sum, there are 4 bytes (0x00000001) which denotes the header type. This value is used to calculate offset from start of DATA record to get first detail table information. If the type 0x00, the offset is 2 bytes, 0x01, the offset is 4 bytes, 0x02 is 8 bytes.

Below is the picture of DATA structure:

sb08

As usual, the value 0x44415441 is DATA signature. The start of data information is located at offset 0xB4 and because OHDR header type is 0x01, it is added 0x4 bytes to get the location of first table information block, as denoted by the blue box above.

The table information block has similar structure to the field information block, so you can see that bytes at offset 0xB8 to 0xB9 (0x0B) is table name sequence number which is “locales” table.

The 4 bytes at offset 0xBC to 0xBF (0x00000C) is the offset location to get the table id for this table. This value is added to the start of DATA structure which is 0xB4 to get 0xC0.

Below is byte information at address location 0xC0:

sb09

The blue box is the table sequence number which will be used to locate the first data block or record of the related table, for this example is first record of locales table.

The red box denotes the next table information block, which has 0x0E as the sequence number which is “languages” table. Again, offset value 0x00000018 is added to 0xB4 to get 0xCC which is 0x00000002 or the table sequence number for “languages” table.

The table sequence number is then multiplied by 4 to get the location of table record detail. So for id 0x01 we get 0x04. This value is added to the start of OHDR data to obtain information about the size of detail records for the table in question:

sb10

From the above picture, 0x4F484452 is OHDR, and you already seen that 4 bytes started at offset 0x9C is the start of header information block. So the calculated 0x4 is added to the offset 0x9C, and we arrived at 0xA0 (blue box).

It has 0xE2, and to get the location of first record data, this value should be divided by 0x8, so we get 0x1C. The value 0x1C is added to the start of DATA block offset (0xB4) so we get 0xD0:

sb11

For each block of data record, it has 0x8 bytes prefix (red box) which contains information about the data record block such as total number of record such as 0x00000B, at offset 0x4 thru 0x7. The actual data starts at offset 0xD8.

To get the length of each record, we should consult the offset information for the last field of the table:

sb12

As you can see from the picture above, offset information is located at 0x8C thru 0x8D, so we get 0x0010. This should be added to the data size of the last field that could be 0x2, 0x4 or 0x8 bytes, depending on the field type information located at offset 0x8A thru 0x8C (0x000C). In this case, the size is 0x02 so the actual record length is 0x12.

Here is some information about the field type and its size of last byte:

0x03,0x04,0x0C,0x0D,0x14,0x15 -> last byte size = 0x2

0x05,0x06,0x0A,0x0F,0x11,0x12,0x13,0x16 -> last byte size = 0x4

0x07,0x08,0x0B -> last byte size = 0x8

The string type (0x0D) inside the detail record is treated as the same with methods to find the field name, which is in the form of sequence number, for example, let’s view the first detail record for “locales” table:

sb13

For the first field data information 0x000F, which is localeid, it is treated as a sequence number and referenced using CHDR structure to get string data from CDAT structure, in this case, 0x000F is “en”.

With all of the relevant information is revealed, it is possible to manually traverse the detail record for this format, or creates some program to do this task 🙂