类文件

时间:2016-10-18 17:20:16

标签: java android android-source android.mk

我想要添加到AOSP的两个库: Azure Storage& Jackson Core

Azure存储依赖于Jackson。

关注this instructions后,我在[MAIN_FOLDER]/externalAndroid.mk个文件下添加了这两个文件:

杰克逊 -

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

LOCAL_MODULE := jackson

LOCAL_MODULE_TAGS := eng debug optional

LOCAL_SDK_VERSION := current

LOCAL_SRC_FILES := $(call all-java-files-under, src/main)

include $(BUILD_JAVA_LIBRARY)

和Azure存储 -

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

LOCAL_MODULE := azure-storage

LOCAL_JAVA_LIBRARIES := jackson

LOCAL_MODULE_TAGS := eng debug optional

LOCAL_SDK_VERSION := current

LOCAL_SRC_FILES := $(call all-java-files-under, src/main)

include $(BUILD_JAVA_LIBRARY)

当我还添加:

PRODUCT_BOOT_JARS := \
    jackson \
    azure-storage

到我的core_minimal.mk

以及以下[MAIN_FOLDER]/frameworks/base/services/core/Android.mk

LOCAL_JAVA_LIBRARIES += jackson azure-storage

唉,当我尝试make update-api && make时, 我收到以下错误:

  

错误:out / target / common / obj / JAVA_LIBRARIES / jackson_intermediates / classes.jar:类文件的未知包名com / fasterxml / jackson / core / JsonLocation.class

     

错误:out / target / common / obj / JAVA_LIBRARIES / azure-storage_intermediates / classes.jar:类文件的未知软件包名称com / microsoft / azure / storage / CorsRule.class

     

make:*** [out / target / common / obj / PACKAGING / boot-jars-package-check_intermediates / stamp]错误1

     

make:***等待未完成的工作......

谢谢!

2 个答案:

答案 0 :(得分:5)

首先,我们最好找到这个错误的来源,用'grep'我们发现它来自Python: build / core / tasks / check_boot_jars / check_boot_jars.py

def CheckJar(jar):
package_name = os.path.dirname(f)
package_name = package_name.replace('/', '.')
# Skip class without a package name
if package_name and not whitelist_re.match(package_name):
    print >> sys.stderr, ('Error: %s: unknown package name of class file %s' % (jar, f))
    return False

显然,如果“whitelist_re”中不存在您的包名,则会出现错误!

“whitelist_re”的值来自名为“ build / core / tasks / check_boot_jars / package_whitelist.txt ”的txt文件,因此解决方案是将您的包添加到此白名单文件中。

示例列在package_whitelist.txt。

答案 1 :(得分:-1)

显然,所有图书馆都必须以com.android.

开头

所以我添加了jarjar-rules.txt以下内容:

rule com.microsoft.** com.android.@0
rule com.fasterxml.** com.android.@0

并将以下行添加到Android.mk

LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt

现在,对com.microsoft.azure.storage.*的所有引用都应更改为com.android.com.microsoft.azure.storage.*fasterxml的引用应相同。