android編譯自己 內建的jar做法,android編譯jar做法

來源:互聯網
上載者:User

android編譯自己 內建的jar做法,android編譯jar做法

   1.首先 android.mk

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


LOCAL_SRC_FILES :=  java/com/xxx/xxx/xxx.java \

                                            java/com/xxx/xxx/xxx2.java 
                    


LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core framework
LOCAL_MODULE_TAGS := eng
LOCAL_MODULE:= test
LOCAL_DX_FLAGS := --core-library

include $(BUILD_JAVA_LIBRARY)


# this is will add the test.xml  
#===============================================================
include $(CLEAR_VARS)
LOCAL_MODULE := test.xml
LOCAL_MODULE_CLASS := ETC
# This will install the file in /system/etc/permissions
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(call all-makefiles-under,$(LOCAL_PATH))

2.test.xml 內容

<permissions>
    <library name="yecon" file="/system/framework/yecon190.jar"/>
</permissions>

3.makesdk.sh

#!/bin/sh
if [ -d $xxx_DIR -a -d $ANDROID4 ]; then
echo "xxx_DIR is : $xxx_DIR"
MANIFEST_FILE=$xxx_DIR/frameworks/xxx/core/MANIFEST.MF
xxxx_SRC_FILE=$ANDROID4/out/target/common/obj/JAVA_LIBRARIES/xxxxx_intermediates/classes
SDK_PATH=$ANDROID4/xxx/sdk
if [ -d $ATCJAR_FILE ];then
mkdir -p $SDK_PATH
chmod a+x $SDK_PATH
jar cvfm $SDK_PATH/yxxx.jar $MANIFEST_FILE -C $xxxx_SRC_FILE.
chmod a+x -R $SDK_PATH
else

echo "++++No such directory: $xxxx_SRC_FILE!+++++"
fi
else
echo "xxx or Android dir not set"
echo "please run command : source ./selfenv bootmedia"
echo "e.g. source ./selfenv sd2"
fi

4.MANIFEST.MF

Manifest-Version: 1.0
Created-By: yecon
Specification-Vender: yecon
Specification-Version: 1.0.0


5.然後將  xxxx 與 xxx.xml 放入系統配置中編譯   PACKAGE=  XXXX   \

                                                                                                           xxxx.xml 

6. 在init.rc 中加入

BOOTCLASSPATH     " :/system/framework/xxxx.jar  "

7.應用或者其他jar中調用

LOCAL_STATIC_JAVA_LIBRARIES :=   xxxxx

或者 

LOCAL_JAVA_LIBRARIES :=   xxxxx




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.