Group: Hardware/History/Howto have a free android sdk

From LibrePlanet
Jump to: navigation, search

Update

aaronw in #libreplanet found that: http://code.google.com/p/android/issues/detail?id=1261

Rationale

A free SDK could permit us to develop free applications for the androids phones such as a replacement for non-free applications that runs on the androids phones such as the market

Documentation on howto compile it

The problem is that with the JDK6(icedtea is a JDK6) we get that error:

$ make sdk
build/core/product_config.mk:261: WARNING: adding test OTA key
============================================
TARGET_PRODUCT=freerunner
TARGET_BUILD_VARIANT=eng
TARGET_SIMULATOR=
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=
============================================
find: File system loop detected; `./external/alsa-lib/include/alsa' is part of the same file system loop as `./external/alsa-lib/include'.
Removing from sdk:
: out/target/product/freerunner/system/bin/dbus-daemon
: out/target/product/freerunner/system/lib/libdbus.so
: out/target/product/freerunner/system/xbin/dbus-monitor
: out/target/product/freerunner/system/xbin/dbus-send
: out/target/product/freerunner/system/xbin/hcidump
: out/target/product/freerunner/system/xbin/opcontrol
: out/target/product/freerunner/system/xbin/oprofiled
target Jar: core-tests (out/target/common/obj/JAVA_LIBRARIES/core-tests_intermediates/javalib.jar)
Install: out/target/product/freerunner/system/app/Mms.apk
Finding NOTICE files: out/target/product/freerunner/obj/NOTICE_FILES/hash-timestamp
Combining NOTICE files: out/target/product/freerunner/obj/NOTICE.txt
Finding NOTICE files: out/host/linux-x86/obj/NOTICE_FILES/hash-timestamp
Combining NOTICE files: out/host/linux-x86/obj/NOTICE.txt
Combining NOTICE files: out/target/product/freerunner/obj/NOTICE.html
gzip -c out/target/product/freerunner/obj/NOTICE.html > out/target/product/freerunner/obj/NOTICE.html.gz
Target system fs image: out/target/product/freerunner/obj/PACKAGING/systemimage_unopt_intermediates/system.img
Install system fs image: out/target/product/freerunner/system.img
Package: out/target/product/freerunner/freerunner-img-eng.android.zip
Docs droiddoc: out/target/common/docs/dx
javadoc: error - In doclet class DroidDoc,  method start has thrown an exception java.lang.reflect.InvocationTargetException
com.sun.tools.javac.code.Symbol$CompletionFailure: class file for sun.util.resources.OpenListResourceBundle not found
1 error
make: *** [out/target/common/docs/dx-timestamp] Error 45

According to the search engines it's not specific to my target but it's a classic error when someone doesn't have the old non-free java5 version

My first try was to try to add the missing class:

so I added the class in /home/android/koolu/build/tools/droiddoc/src

cd /home/android/koolu/build/tools/droiddoc/src
mkdir -p sun/util/resources/
cp ~/errors/OpenListResourceBundle.java sun/util/resources/

And I modified the Android.mk like this:

LOCAL_SRC_FILES := \
+     sun/util/resources/OpenListResourceBundle.java \

while it compiled the class and added it where it should do it didn't work and I had the same error(I didn't understand if it came back later or if the build process had rebuild more things before failing)

Then I tried to add :

LOCAL_DROIDDOC_USE_STANDARD_DOCLET := true

in /home/android/koolu/buildspec.mk It didn't worked...so I did something ugly:I added it to the top of this file instead:

/koolu/build/core/droiddoc.mk

and it passed the error with a lot of warnings

How/Why it works

here's the interesting part of the Makefile

ifneq ($(strip $(LOCAL_DROIDDOC_USE_STANDARD_DOCLET)),true)
##
##
## droiddoc only
##
## 

droiddoc_templates := \
    $(shell find $(LOCAL_DROIDDOC_TEMPLATE_DIR) -type f) \
    $(shell find $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR) -type f) 
 
droiddoc := \ 
 	$(HOST_JDK_TOOLS_JAR) \ 
	$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX) \
	$(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX) \
	$(HOST_OUT_SHARED_LIBRARIES)/libclearsilver-jni$(HOST_JNILIB_SUFFIX)

$(full_target): PRIVATE_DOCLETPATH := $(HOST_OUT_JAVA_LIBRARIES)/clearsilver$(COMMON_JAVA_PACKAGE_SUFFIX):$(HOST_OUT_JAVA_LIBRARIES)/droiddoc$(COMMON_JAVA_PACKAGE_SUFFIX)
$(full_target): PRIVATE_CURRENT_BUILD := -hdf page.build $(BUILD_ID)-$(BUILD_NUMBER)
$(full_target): PRIVATE_CURRENT_TIME :=  -hdf page.now "$(shell date "+%d %b %Y %k:%M")"
$(full_target): PRIVATE_TEMPLATE_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)
$(full_target): PRIVATE_CUSTOM_TEMPLATE_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)
$(full_target): PRIVATE_IN_ASSET_DIR := $(LOCAL_DROIDDOC_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_IN_CUSTOM_ASSET_DIR := $(LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
$(full_target): PRIVATE_OUT_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_ASSET_DIR)
$(full_target): PRIVATE_OUT_CUSTOM_ASSET_DIR := $(out_dir)/$(LOCAL_DROIDDOC_CUSTOM_ASSET_DIR)
ifneq ($(strip $(LOCAL_DROIDDOC_HTML_DIR)),)
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := -htmldir $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR)
else
$(full_target): PRIVATE_DROIDDOC_HTML_DIR := 
endif 

# TODO: not clear if this is used any more
$(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) 

html_dir_files := $(shell find $(LOCAL_PATH)/$(LOCAL_DROIDDOC_HTML_DIR) -type f) 

$(full_target): $(full_src_files) $(droiddoc_templates) $(droiddoc) $(html_dir_files) $(full_java_lib_deps)
	@echo Docs droiddoc: $(PRIVATE_OUT_DIR)
	$(hide) mkdir -p $(dir $(full_target))
	$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
			$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
	$(hide) ( \
		LD_LIBRARY_PATH=$(HOST_OUT_SHARED_LIBRARIES) \
		javadoc \
               \@$(PRIVATE_SRC_LIST_FILE) \
               -J-Xmx768m \
               -J-Djava.library.path=$(HOST_OUT_SHARED_LIBRARIES) \
               $(PRIVATE_PROFILING_OPTIONS) \
               -quiet \
               -doclet DroidDoc \
               -docletpath $(PRIVATE_DOCLETPATH) \
               -templatedir $(PRIVATE_CUSTOM_TEMPLATE_DIR) \
               -templatedir $(PRIVATE_TEMPLATE_DIR) \
               $(PRIVATE_DROIDDOC_HTML_DIR) \
               $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
               -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
               -d $(PRIVATE_OUT_DIR) \
               $(PRIVATE_CURRENT_BUILD) $(PRIVATE_CURRENT_TIME) \
               $(PRIVATE_DROIDDOC_OPTIONS) \
       && rm -rf $(PRIVATE_OUT_ASSET_DIR) \
       && rm -rf $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
       && mkdir -p $(PRIVATE_OUT_ASSET_DIR) \
       && mkdir -p $(PRIVATE_OUT_CUSTOM_ASSET_DIR) \
       && cp -fr $(PRIVATE_IN_ASSET_DIR)/* $(PRIVATE_OUT_ASSET_DIR)/ \
       && cp -fr $(PRIVATE_IN_CUSTOM_ASSET_DIR)/* $(PRIVATE_OUT_CUSTOM_ASSET_DIR)/ \
       && touch -f $@ \
   ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)
 


else
##
##
## standard doclet only
##
##
$(full_target): $(full_src_files) $(full_java_lib_deps)
	@echo Docs javadoc: $(PRIVATE_OUT_DIR)
	@mkdir -p $(dir $(full_target))
	$(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \
			$(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR))
	$(hide) ( \
		javadoc \
               \@$(PRIVATE_SRC_LIST_FILE) \
               -J-Xmx768m \
               $(PRIVATE_PROFILING_OPTIONS) \
               $(addprefix -classpath ,$(PRIVATE_CLASSPATH)) \
               -sourcepath $(PRIVATE_SOURCE_PATH)$(addprefix :,$(PRIVATE_CLASSPATH)) \
               -d $(PRIVATE_OUT_DIR) \
               -quiet \
       && touch -f $@ \
   ) || (rm -rf $(PRIVATE_OUT_DIR) $(PRIVATE_SRC_LIST_FILE); exit 45)


endif

Basically it make use of the standard doclet instead of android's doclet

How to use it