简体   繁体   中英

Android library (jar) needs functionality from another library

I'm trying to write an android library which takes functionality from another library, the problem is in essence there's an in app billing library and I want to write an interface to it as a separate jar library to be included in a project.

How can I do this if it's at all possible? If not what are my options? I tried building the classes in my jar library but when I try to invoke functions from the other library I get the following error:

AndroidJavaException: java.lang.ExceptionInInitializerError

Full logcat:

--------- beginning of /dev/log/system --------- beginning of /dev/log/main D/Unity (14530): GL_OES_rgb8_rgba8 GL_OES_EGL_sync GL_OES_fbo_render_mipmap GL_NV_depth_nonlinear GL_NV_draw_path GL_NV_texture_npot_2D_mipmap GL_OE S_EGL_image GL_OES_EGL_image_external GL_OES_vertex_half_float GL_OES_mapbuffer GL_NV_draw_buffers GL_NV_multiview_draw_buffers GL_EXT_Cg_shader GL_EX T_packed_float GL_OES_texture_half_float GL_EXT_texture_array GL_OES_compressed_ETC1_RGB8_texture GL_EXT_texture_compression_latc GL_NV_texture_compre ssion_latc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_s3tc GL_NV_texture_compression_s3tc GL_EXT_texture_filter_anisotropic GL_NV_get_ tex_image GL_NV_read_buffer GL_NV_shader_framebuffer_fetch GL_NV_copy_image GL_NV_fbo_color_attachments GL_EXT_bgra GL_EXT_texture_format_BGRA8888 GL_ EXT_unpack_subimage GL_NV_pack_subimage GL_NV_texture_compression_s3tc_update GL_NV_read_depth GL_NV_read_stencil GL_NV_uniform_buffer_object GL_EXT_r obustness GL_OES_sta ndard_derivatives GL_NV_EGL_stream_consumer_external GL_NV_3dvision_settings GL_EXT_debug_marker GL_EXT_debug_label GL_NV_ D/Unity (14530): coverage_sample GL_EXT_occlusion_query_boolean GL_NV_timer_query I/Unity (14530): AndroidJavaException: java.lang.ExceptionInInitializerError I/Unity (14530): at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in :0 I/Unity (14530): at UnityEngine.AndroidJNISafe.CallStringMethod (IntPtr obj, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in :0 I/Unity (14530): at UnityEngine.AndroidJavaObject._Call[String] (System.String methodName, System.Object[] args) [0x00000] in :0

I/Unity (14530): at UnityEngine.AndroidJavaObject.Call[String] (System.String methodName, System.Object[] args) [0x00000] in :0

I/Unity (14530): at CallJavaCode.Start () [0x00000] in :0 I/Unity (14530): I/Unity (14530): (Filename: Line: -1)

I discovered that I could print the stack trace from the exception in Java, when I did that I noticed it was asking about calling Looper.prepare(), when I called that function first it fixed the problem I was having.

The way i integrated the functionality from the other jar was to simply merge their contents.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM