Unknown package name of class file
Asked Answered
E

2

2

I have two libraries that I want to add to AOSP: Azure Storage & Jackson Core

When Azure Storage depends on Jackson.

Following this instructions, I've added both of them under [MAIN_FOLDER]/external and with the following Android.mk files:

For Jackson -

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)

and for Azure storage -

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)

When I also added:

PRODUCT_BOOT_JARS := \
    jackson \
    azure-storage

to my core_minimal.mk.

and the following to [MAIN_FOLDER]/frameworks/base/services/core/Android.mk:

LOCAL_JAVA_LIBRARIES += jackson azure-storage

Alas, when I try to make update-api && make, I get the following error:

Error: out/target/common/obj/JAVA_LIBRARIES/jackson_intermediates/classes.jar: unknown package name of class file com/fasterxml/jackson/core/JsonLocation.class

Error: out/target/common/obj/JAVA_LIBRARIES/azure-storage_intermediates/classes.jar: unknown package name of class file com/microsoft/azure/storage/CorsRule.class

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

make: *** Waiting for unfinished jobs....

Thanks!

Encroachment answered 18/10, 2016 at 17:20 Comment(0)
A
6

First, we'd better find where this error comes from, with 'grep' we found it comes from a 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

Apparently, if your package name not exists in "whitelist_re", you got the error!

"whitelist_re"'s values come from a txt file named "build/core/tasks/check_boot_jars/package_whitelist.txt", so the solution is add your package to this whitelist file.

Examples are listed in package_whitelist.txt.

Ammieammine answered 13/8, 2017 at 1:37 Comment(0)
E
-2

Apparently all libraries have to start with com.android.,

so I've added jarjar-rules.txt with the following:

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

and added the following line to Android.mk:

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

Now, all the references to com.microsoft.azure.storage.* should be changed to com.android.com.microsoft.azure.storage.* and the same for fasterxml.

Encroachment answered 18/10, 2016 at 23:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.