diff --git a/android/README b/android/README index 81cd416107..2b1bd2ab6c 100644 --- a/android/README +++ b/android/README @@ -20,16 +20,10 @@ Use this as your build folder, using '../tools/configure' etc. $ ../tools/configure # type 200, then chose A for android and your screen resolution $ make -After the build finished, build the zip file: - $ make zip - -Create a debug signing key: - $ keytool -genkey -alias androiddebugkey -keystore $HOME/.android/debug.keystore -storepass android -keypass android -validity 365 -dname "CN=Android Debug,O=Android,C=US" - -Then, you can create a Rockbox.apk which ends up in bin/ +After the build finished, build the apk file: $ make apk -You can install that on the device: +You can install that on your device or emulator with the following command: $ $ANDROID_SDK_PATH/tools/adb install -r bin/Rockbox.apk diff --git a/android/android.make b/android/android.make index 16fdb12e45..8cb52bbbba 100644 --- a/android/android.make +++ b/android/android.make @@ -19,17 +19,18 @@ PACKAGE_PATH=org/rockbox ANDROID_DIR=$(ROOTDIR)/android BINLIB_DIR=$(BUILDDIR)/libs/armeabi - java2class = $(addsuffix .class,$(basename $(subst $(ANDROID_DIR),$(BUILDDIR),$(1)))) +# API version ANDROID_PLATFORM_VERSION=8 - ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION) + +# android tools AAPT=$(ANDROID_PLATFORM)/tools/aapt DX=$(ANDROID_PLATFORM)/tools/dx APKBUILDER=$(ANDROID_SDK_PATH)/tools/apkbuilder ZIPALIGN=$(ANDROID_SDK_PATH)/tools/zipalign - +KEYSTORE=$(HOME)/.android/debug.keystore MANIFEST := $(ANDROID_DIR)/AndroidManifest.xml @@ -53,17 +54,19 @@ DIRS += $(subst ___,data,$(_DIRS)) DIRS += $(BUILDDIR)/libs/armeabi $(R_JAVA) $(AP_): $(MANIFEST) - $(call PRINTS,AAPT $(subst $(BUILDDIR)/,,$@))$(AAPT) package -f -m -J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res -I $(ANDROID_PLATFORM)/android.jar -F $(AP_) + $(call PRINTS,AAPT $(subst $(BUILDDIR)/,,$@))$(AAPT) package -f -m \ + -J $(BUILDDIR)/gen -M $(MANIFEST) -S $(ANDROID_DIR)/res \ + -I $(ANDROID_PLATFORM)/android.jar -F $(AP_) $(BUILDDIR)/bin/$(PACKAGE_PATH)/R.class: $(R_JAVA) $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ - -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin -sourcepath \ - $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< + -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin \ + -sourcepath $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< $(BUILDDIR)/bin/$(PACKAGE_PATH)/%.class: $(ANDROID_DIR)/src/$(PACKAGE_PATH)/%.java $(call PRINTS,JAVAC $(subst $(ROOTDIR)/,,$<))javac -d $(BUILDDIR)/bin \ - -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin -sourcepath \ - $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< + -classpath $(ANDROID_PLATFORM)/android.jar:$(BUILDDIR)/bin \ + -sourcepath $(ANDROID_DIR)/gen:$(ANDROID_DIR)/src $< $(DEX): $(R_OBJ) $(JAVA_OBJ) $(call PRINTS,DX $(subst $(BUILDDIR)/,,$@))$(DX) --dex --output=$@ $(BUILDDIR)/bin @@ -75,32 +78,36 @@ dex: $(DEX) $(BINLIB_DIR)/$(BINARY): $(BUILDDIR)/$(BINARY) $(call PRINTS,CP $(BINARY))cp $^ $@ -$(BUILDDIR)/rockbox.zip: +$(BUILDDIR)/rockbox.zip: zip $(BINLIB_DIR)/libmisc.so: $(BUILDDIR)/rockbox.zip $(call PRINTS,CP rockbox.zip)cp $^ $@ libs: $(LIBS) -$(TEMP_APK): $(LIBS) $(DEX) +$(TEMP_APK): $(DIRS) $(LIBS) $(DEX) $(call PRINTS,APK $(subst $(BUILDDIR)/,,$@))$(APKBUILDER) $@ \ -u -z $(AP_) -f $(DEX) -nf $(BUILDDIR)/libs -$(APK): $(TEMP_APK) +$(KEYSTORE): + $(call PRINTS,KEYTOOL debug.keystore)keytool -genkey \ + -alias androiddebugkey -keystore $@ \ + -storepass android -keypass android -validity 365 \ + -dname "CN=Android Debug,O=Android,C=US" + +$(APK): $(TEMP_APK) $(BUILDDIR)/rockbox.zip $(KEYSTORE) $(SILENT)rm -f $@ $(call PRINTS,SIGN $(subst $(BUILDDIR)/,,$@))jarsigner \ - -keystore "$(HOME)/.android/debug.keystore" -storepass "android" \ - -keypass "android" -signedjar $(TEMP_APK2) $^ "androiddebugkey" + -keystore "$(KEYSTORE)" -storepass "android" -keypass "android" \ + -signedjar $(TEMP_APK2) $(TEMP_APK) "androiddebugkey" $(SILENT)$(ZIPALIGN) -v 4 $(TEMP_APK2) $@ > /dev/null - $(SILENT)rm $(TEMP_APK) $(TEMP_APK2) $(DIRS): $(SILENT)mkdir -p $@ dirs: $(DIRS) -apk: $(DIRS) $(APK) +apk: $(APK) clean:: $(SILENT)rm -f $(BUILDDIR)/bin/$(PACKAGE_PATH)/*.class $(R_JAVA) $(TEMP_APK) $(TEMP_APK2) $(APK) $(DEX) $(BUILDDIR)/_rockbox.zip $(AP_) $(LIBS) -