编译android java_shared_jar
发布日期:2021-09-01 17:00:05 浏览次数:1 分类:技术文章

本文共 2424 字,大约阅读时间需要 8 分钟。

hot3.png

共享第三方jar

两种引用方法:

1,AndroidManifest.xml

    <application

        android:name="android.letvmedia.cts.MyApplication"
        android:allowBackup="true"
        android:debuggable="true" >
        <uses-library android:name="myjar" />

2,Android.mk

LOCAL_JAVA_LIBRARIES += myjar

创建共享jar的方法:

1,

aa.java :

/*************************************************************************
> File Name: aa.java
> Author:
> Mail:
> Created Time: Thu 24 Mar 2016 07:07:20 PM CST
 ************************************************************************/
class aa {
}

2,

编译出myjar.jar 类似framwork.jar

Android.mk :

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += \
                     myprebuild.jar
#LOCAL_PREBUILT_LIBS += \
include $(BUILD_MULTI_PREBUILT)
###########################################################################
include $(CLEAR_VARS)
#LOCAL_SRC_FILES += \
#      android/dolby/xxx.aidl \
#      android/dolby/xxxxxxxx.aidl
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_STATIC_JAVA_LIBRARIES := myprebuild
LOCAL_SRC_FILES := ./aa.java
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := myjar1
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_NO_EMMA_INSTRUMENT := true
LOCAL_NO_EMMA_COMPILE := true
LOCAL_DX_FLAGS := --core-library
#LOCAL_MODULE_OWNER := myname
#LOCAL_SDK_VERSION := current
include $(BUILD_JAVA_LIBRARY)
#endif,

3,

创建 myjar.xml指明jar包对应的存放路径。

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
          http://www.apache.org/licenses/LICENSE-2.0
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<permissions>
    <library name="myjar"
            file="/system/framework/myjar1.jar" />
</permissions>
4,

推配置文件myjar.xml 以及生成的myjar1.jar到相应的目录,使之可以被系统看见

可以执行下面的命令

adb root

adb remount
echo "modify permission ,config library path doing"
adb push myjar.xml /system/etc/permissions/
#echo "modify permission ,config library path done"
echo "push myjar1.jar in"
adb push myjar1.jar system/framework/
#echo "push myjar1.jar out"
echo "adb reboot"
adb reboot

转载于:https://my.oschina.net/u/269082/blog/647314

转载地址:https://blog.csdn.net/weixin_34122810/article/details/91999347 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:重点URL访问监控-当天和前一天相同时间段内的访问对比-python
下一篇:新浪网技术部笔试题

发表评论

最新留言

逛到本站,mark一下
[***.202.152.39]2024年04月02日 09时51分10秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章