Note that there are some explanatory texts on larger screens.

plurals
  1. POandroid runtime linking issue with interface
    primarykey
    data
    text
    <p>I am trying to build an application and an interface jar using he android build system in Linux My application has a dependency with my interface, hence I have to make interface jar ready before application make.</p> <p>But we faced build/run time issues while using our newly built interface jar. We have tried to make the application in two different sequence.</p> <p>Case 1. Building the interface as local module and linking it with apk as LOCAL_JAVA_LIBRARIES. Case 2. Building the interface as local module and linking it with apk as LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES.</p> <h2>Following are the Android.mk files for main and interface.</h2> <p>1.Main Andriod.mk file: <strong>/source/Android.mk</strong></p> <p>=======================================</p> <p>STACK_PATH:= $(call my-dir)</p> <p>LOCAL_PATH := $(STACK_PATH)</p> <p>include $(CLEAR_VARS)</p> <p>include $(LOCAL_PATH)/interface/Android.mk</p> <p>include $(CLEAR_VARS)</p> <p>LOCAL_PATH := $(STACK_PATH)</p> <p>include $(LOCAL_PATH)/application/Android.mk</p> <p>=======================================</p> <p>2.Interface Android.mk : <strong>/source/interface/Android.mk</strong></p> <p>=======================================</p> <p>LOCAL_PATH:= $(call my-dir)</p> <p>include $(CLEAR_VARS)</p> <p>LOCAL_SRC_FILES := $(call all-subdir-java-files, src)</p> <p>LOCAL_MODULE := MyInterface</p> <p>LOCAL_MODULE_TAGS := optional</p> <p>LOCAL_MODULE_CLASS := JAVA_LIBRARIES</p> <p>LOCAL_JAVA_RESOURCE_DIRS := src</p> <p>include $(BUILD_JAVA_LIBRARY)</p> <p>$(call dist-for-goals, droidcore, $(full_classes_jar):MyInterface.jar)</p> <p>=======================================</p> <h2>Following are the Android.mk files for application in CASE 1.</h2> <p>Application Android.mk: <strong>/source/application/Android.mk</strong></p> <p>=======================================</p> <p>TOP_LOCAL_PATH:= $(call my-dir)</p> <p>LOCAL_PATH:= $(TOP_LOCAL_PATH)</p> <p>include $(CLEAR_VARS)</p> <p>LOCAL_SRC_FILES := $(call all-subdir-java-files)</p> <p>LOCAL_PACKAGE_NAME := MyApplication</p> <p>LOCAL_JAVA_LIBRARIES := MyInterface</p> <p>include $(BUILD_PACKAGE)</p> <p>include $(BUILD_MULTI_PREBUILT)</p> <p>=======================================</p> <p>Build completed successfully .But when trying to run this application, it shows this error. I/dalvikvm( XXXX): Failed resolving Lcom/test/example/application; interface XXX 'Lcom/test/example/interface;' W/dalvikvm( XXXX): Link of class 'Lcom/test/example/application;' failed</p> <h2>Following are the Android.mk files for application in CASE 2.</h2> <p>Application Android.mk <strong>/source/application/Android.mk</strong></p> <p>=======================================</p> <p>TOP_LOCAL_PATH:= $(call my-dir)</p> <p>LOCAL_PATH:= $(TOP_LOCAL_PATH)</p> <p>include $(CLEAR_VARS)</p> <p>$(shell (cp $(LOCAL_PATH)/../out/target/common/obj/JAVA_LIBRARIES/Interface_intermediates/classes-jarjar.jar $(LOCAL_PATH)/applications/libs/MyInterface.jar ))</p> <p>LOCAL_STATIC_JAVA_LIBRARIES += MyInterface</p> <p>LOCAL_SRC_FILES := $(call all-subdir-java-files)</p> <p>LOCAL_PACKAGE_NAME := MyApplicationss</p> <p>LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += MyInterface:libs/MyInterface.jar</p> <p>include $(BUILD_PACKAGE)</p> <p>include $(BUILD_MULTI_PREBUILT)</p> <p>=======================================</p> <p>This resulted in a build error as follows.</p> <p><strong>build/core/base_rules.mk:166: * source/applications: MODULE.TARGET.JAVA_LIBRARIES.MyInterface already defined by source/interface. Stop.</strong></p> <p>But when they are built seperately without using the build system, this problem is not there.Also the application runs without error.</p> <hr> <p>When the interface was built to Myinterface.jar using the eclipse, and build the application-apk using this interface jar(by linking statically) in Linux, the application ran smoothly.</p> <p>Is there any issue in our Android.mk files? Please review and give your suggestions</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload