Error de UnsatisfiedLink: Método nativo no encontrado findLibrary devuelto null
Estoy trabajando en el proyecto android relacionado con android JNI y NDK. He loade todos los archivos .so necesarios para el proyecto. Pero sigue mostrando error que UnsatisfiedLink Error, método nativo no encontrado, findLibrary retuned null, java.lang.Runtime,
Mi imagen de registro se da a continuación
- Diferencia entre CMake y NDK en el proyecto de estudio android
- Android NDK aplicación se estrelló en ejecutar en funciones que ni siquiera llamado
- Cambiar las ubicaciones de salida de ndk-build
- No se puede encontrar android NDK constructor r9 para mac
- Creación de NDK con un archivo mk diferente para la versión / depuración
Se ve claramente desde la imagen.La biblioteca se añade, pero ¿por qué está dando error?
Hay un archivo más que está teniendo declaración de la función nativa en el archivo Utilities.java
Mi código es
package me.frankly.utils; import java.nio.ByteBuffer; import android.util.Log; public class Utilities { static { try { System.loadLibrary("videocompression"); } catch(Exception e) { Log.d("Exception",e.toString()); } } public native static int convertVideoFrame(ByteBuffer src, ByteBuffer dest, int destFormat, int width, int height, int padding, int swap); }
Código nativo :
#include <jni.h> #include <libyuv.h> #include <utils.h> enum COLOR_FORMATTYPE { COLOR_FormatMonochrome = 1, COLOR_Format8bitRGB332 = 2, COLOR_Format12bitRGB444 = 3, COLOR_Format16bitARGB4444 = 4, COLOR_Format16bitARGB1555 = 5, COLOR_Format16bitRGB565 = 6, COLOR_Format16bitBGR565 = 7, COLOR_Format18bitRGB666 = 8, COLOR_Format18bitARGB1665 = 9, COLOR_Format19bitARGB1666 = 10, COLOR_Format24bitRGB888 = 11, COLOR_Format24bitBGR888 = 12, COLOR_Format24bitARGB1887 = 13, COLOR_Format25bitARGB1888 = 14, COLOR_Format32bitBGRA8888 = 15, COLOR_Format32bitARGB8888 = 16, COLOR_FormatYUV411Planar = 17, COLOR_FormatYUV411PackedPlanar = 18, COLOR_FormatYUV420Planar = 19, COLOR_FormatYUV420PackedPlanar = 20, COLOR_FormatYUV420SemiPlanar = 21, COLOR_FormatYUV422Planar = 22, COLOR_FormatYUV422PackedPlanar = 23, COLOR_FormatYUV422SemiPlanar = 24, COLOR_FormatYCbYCr = 25, COLOR_FormatYCrYCb = 26, COLOR_FormatCbYCrY = 27, COLOR_FormatCrYCbY = 28, COLOR_FormatYUV444Interleaved = 29, COLOR_FormatRawBayer8bit = 30, COLOR_FormatRawBayer10bit = 31, COLOR_FormatRawBayer8bitcompressed = 32, COLOR_FormatL2 = 33, COLOR_FormatL4 = 34, COLOR_FormatL8 = 35, COLOR_FormatL16 = 36, COLOR_FormatL24 = 37, COLOR_FormatL32 = 38, COLOR_FormatYUV420PackedSemiPlanar = 39, COLOR_FormatYUV422PackedSemiPlanar = 40, COLOR_Format18BitBGR666 = 41, COLOR_Format24BitARGB6666 = 42, COLOR_Format24BitABGR6666 = 43, COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100, COLOR_FormatSurface = 0x7F000789, COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00 }; int isSemiPlanarYUV(int colorFormat) { switch (colorFormat) { case COLOR_FormatYUV420Planar: case COLOR_FormatYUV420PackedPlanar: return 0; case COLOR_FormatYUV420SemiPlanar: case COLOR_FormatYUV420PackedSemiPlanar: case COLOR_TI_FormatYUV420PackedSemiPlanar: return 1; default: return 0; } } JNIEXPORT int Java_me_frankly_utils_Utilities_convertVideoFrame( JNIEnv *env, jclass class, jobject src, jobject dest, int destFormat, int width, int height, int padding, int swap) { if (!src || !dest || !destFormat) { return 0; } jbyte *srcBuff = (*env)->GetDirectBufferAddress(env, src); jbyte *destBuff = (*env)->GetDirectBufferAddress(env, dest); int half_width = (width + 1) / 2; int half_height = (height + 1) / 2; if (!isSemiPlanarYUV(destFormat)) { if (!swap) { ARGBToI420(srcBuff, width * 4, destBuff, width, destBuff + width * height + half_width * half_height + padding * 5 / 4, half_width, destBuff + width * height + padding, half_width, width, height); } else { ARGBToI420(srcBuff, width * 4, destBuff, width, destBuff + width * height + padding, half_width, destBuff + width * height + half_width * half_height + padding * 5 / 4, half_width, width, height); } } else { if (!swap) { ARGBToNV21(srcBuff, width * 4, destBuff, width, destBuff + width * height + padding, half_width * 2, width, height); } else { ARGBToNV12(srcBuff, width * 4, destBuff, width, destBuff + width * height + padding, half_width * 2, width, height); } } return 1; }
Este es mi archivo .h generado por javah -jni
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class me_frankly_utils_Utilities */ #ifndef _Included_me_frankly_utils_Utilities #define _Included_me_frankly_utils_Utilities #ifdef __cplusplus extern "C" { #endif /* * Class: me_frankly_utils_Utilities * Method: convertVideoFrame * Signature: (Ljava/nio/ByteBuffer;Ljava/nio/ByteBuffer;IIIII)I */ JNIEXPORT jint JNICALL Java_me_frankly_utils_Utilities_convertVideoFrame (JNIEnv *, jclass, jobject, jobject, jint, jint, jint, jint, jint); #ifdef __cplusplus } #endif #endif
Aquí está mi código de archivo de Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_PRELINK_MODULE := false LOCAL_MODULE := videocompression LOCAL_CFLAGS := -w -std=gnu99 -O2 -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64 LOCAL_CFLAGS += -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno LOCAL_CFLAGS += -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT LOCAL_CPPFLAGS := -DBSD=1 -ffast-math -O2 -funroll-loops #LOCAL_LDLIBS := -llog LOCAL_LDLIBS := -ljnigraphics -llog LOCAL_SRC_FILES := \ ./opus/src/opus.c \ ./opus/src/opus_decoder.c \ ./opus/src/opus_encoder.c \ ./opus/src/opus_multistream.c \ ./opus/src/opus_multistream_encoder.c \ ./opus/src/opus_multistream_decoder.c \ ./opus/src/repacketizer.c \ ./opus/src/analysis.c \ ./opus/src/mlp.c \ ./opus/src/mlp_data.c LOCAL_SRC_FILES += \ ./opus/silk/CNG.c \ ./opus/silk/code_signs.c \ ./opus/silk/init_decoder.c \ ./opus/silk/decode_core.c \ ./opus/silk/decode_frame.c \ ./opus/silk/decode_parameters.c \ ./opus/silk/decode_indices.c \ ./opus/silk/decode_pulses.c \ ./opus/silk/decoder_set_fs.c \ ./opus/silk/dec_API.c \ ./opus/silk/enc_API.c \ ./opus/silk/encode_indices.c \ ./opus/silk/encode_pulses.c \ ./opus/silk/gain_quant.c \ ./opus/silk/interpolate.c \ ./opus/silk/LP_variable_cutoff.c \ ./opus/silk/NLSF_decode.c \ ./opus/silk/NSQ.c \ ./opus/silk/NSQ_del_dec.c \ ./opus/silk/PLC.c \ ./opus/silk/shell_coder.c \ ./opus/silk/tables_gain.c \ ./opus/silk/tables_LTP.c \ ./opus/silk/tables_NLSF_CB_NB_MB.c \ ./opus/silk/tables_NLSF_CB_WB.c \ ./opus/silk/tables_other.c \ ./opus/silk/tables_pitch_lag.c \ ./opus/silk/tables_pulses_per_block.c \ ./opus/silk/VAD.c \ ./opus/silk/control_audio_bandwidth.c \ ./opus/silk/quant_LTP_gains.c \ ./opus/silk/VQ_WMat_EC.c \ ./opus/silk/HP_variable_cutoff.c \ ./opus/silk/NLSF_encode.c \ ./opus/silk/NLSF_VQ.c \ ./opus/silk/NLSF_unpack.c \ ./opus/silk/NLSF_del_dec_quant.c \ ./opus/silk/process_NLSFs.c \ ./opus/silk/stereo_LR_to_MS.c \ ./opus/silk/stereo_MS_to_LR.c \ ./opus/silk/check_control_input.c \ ./opus/silk/control_SNR.c \ ./opus/silk/init_encoder.c \ ./opus/silk/control_codec.c \ ./opus/silk/A2NLSF.c \ ./opus/silk/ana_filt_bank_1.c \ ./opus/silk/biquad_alt.c \ ./opus/silk/bwexpander_32.c \ ./opus/silk/bwexpander.c \ ./opus/silk/debug.c \ ./opus/silk/decode_pitch.c \ ./opus/silk/inner_prod_aligned.c \ ./opus/silk/lin2log.c \ ./opus/silk/log2lin.c \ ./opus/silk/LPC_analysis_filter.c \ ./opus/silk/LPC_inv_pred_gain.c \ ./opus/silk/table_LSF_cos.c \ ./opus/silk/NLSF2A.c \ ./opus/silk/NLSF_stabilize.c \ ./opus/silk/NLSF_VQ_weights_laroia.c \ ./opus/silk/pitch_est_tables.c \ ./opus/silk/resampler.c \ ./opus/silk/resampler_down2_3.c \ ./opus/silk/resampler_down2.c \ ./opus/silk/resampler_private_AR2.c \ ./opus/silk/resampler_private_down_FIR.c \ ./opus/silk/resampler_private_IIR_FIR.c \ ./opus/silk/resampler_private_up2_HQ.c \ ./opus/silk/resampler_rom.c \ ./opus/silk/sigm_Q15.c \ ./opus/silk/sort.c \ ./opus/silk/sum_sqr_shift.c \ ./opus/silk/stereo_decode_pred.c \ ./opus/silk/stereo_encode_pred.c \ ./opus/silk/stereo_find_predictor.c \ ./opus/silk/stereo_quant_pred.c LOCAL_SRC_FILES += \ ./opus/silk/fixed/LTP_analysis_filter_FIX.c \ ./opus/silk/fixed/LTP_scale_ctrl_FIX.c \ ./opus/silk/fixed/corrMatrix_FIX.c \ ./opus/silk/fixed/encode_frame_FIX.c \ ./opus/silk/fixed/find_LPC_FIX.c \ ./opus/silk/fixed/find_LTP_FIX.c \ ./opus/silk/fixed/find_pitch_lags_FIX.c \ ./opus/silk/fixed/find_pred_coefs_FIX.c \ ./opus/silk/fixed/noise_shape_analysis_FIX.c \ ./opus/silk/fixed/prefilter_FIX.c \ ./opus/silk/fixed/process_gains_FIX.c \ ./opus/silk/fixed/regularize_correlations_FIX.c \ ./opus/silk/fixed/residual_energy16_FIX.c \ ./opus/silk/fixed/residual_energy_FIX.c \ ./opus/silk/fixed/solve_LS_FIX.c \ ./opus/silk/fixed/warped_autocorrelation_FIX.c \ ./opus/silk/fixed/apply_sine_window_FIX.c \ ./opus/silk/fixed/autocorr_FIX.c \ ./opus/silk/fixed/burg_modified_FIX.c \ ./opus/silk/fixed/k2a_FIX.c \ ./opus/silk/fixed/k2a_Q16_FIX.c \ ./opus/silk/fixed/pitch_analysis_core_FIX.c \ ./opus/silk/fixed/vector_ops_FIX.c \ ./opus/silk/fixed/schur64_FIX.c \ ./opus/silk/fixed/schur_FIX.c LOCAL_SRC_FILES += \ ./opus/celt/bands.c \ ./opus/celt/celt.c \ ./opus/celt/celt_encoder.c \ ./opus/celt/celt_decoder.c \ ./opus/celt/cwrs.c \ ./opus/celt/entcode.c \ ./opus/celt/entdec.c \ ./opus/celt/entenc.c \ ./opus/celt/kiss_fft.c \ ./opus/celt/laplace.c \ ./opus/celt/mathops.c \ ./opus/celt/mdct.c \ ./opus/celt/modes.c \ ./opus/celt/pitch.c \ ./opus/celt/celt_lpc.c \ ./opus/celt/quant_bands.c \ ./opus/celt/rate.c \ ./opus/celt/vq.c \ ./opus/celt/arm/armcpu.c \ ./opus/celt/arm/arm_celt_map.c LOCAL_SRC_FILES += \ ./opus/ogg/bitwise.c \ ./opus/ogg/framing.c \ ./opus/opusfile/info.c \ ./opus/opusfile/internal.c \ ./opus/opusfile/opusfile.c \ ./opus/opusfile/stream.c LOCAL_C_INCLUDES := \ ./opus/include \ ./opus/silk \ ./opus/silk/fixed \ ./opus/celt \ ./opus/ \ ./opus/opusfile \ ./libyuv/include LOCAL_SRC_FILES += \ ./libjpeg/jcapimin.c \ ./libjpeg/jcapistd.c \ ./libjpeg/armv6_idct.S \ ./libjpeg/jccoefct.c \ ./libjpeg/jccolor.c \ ./libjpeg/jcdctmgr.c \ ./libjpeg/jchuff.c \ ./libjpeg/jcinit.c \ ./libjpeg/jcmainct.c \ ./libjpeg/jcmarker.c \ ./libjpeg/jcmaster.c \ ./libjpeg/jcomapi.c \ ./libjpeg/jcparam.c \ ./libjpeg/jcphuff.c \ ./libjpeg/jcprepct.c \ ./libjpeg/jcsample.c \ ./libjpeg/jctrans.c \ ./libjpeg/jdapimin.c \ ./libjpeg/jdapistd.c \ ./libjpeg/jdatadst.c \ ./libjpeg/jdatasrc.c \ ./libjpeg/jdcoefct.c \ ./libjpeg/jdcolor.c \ ./libjpeg/jddctmgr.c \ ./libjpeg/jdhuff.c \ ./libjpeg/jdinput.c \ ./libjpeg/jdmainct.c \ ./libjpeg/jdmarker.c \ ./libjpeg/jdmaster.c \ ./libjpeg/jdmerge.c \ ./libjpeg/jdphuff.c \ ./libjpeg/jdpostct.c \ ./libjpeg/jdsample.c \ ./libjpeg/jdtrans.c \ ./libjpeg/jerror.c \ ./libjpeg/jfdctflt.c \ ./libjpeg/jfdctfst.c \ ./libjpeg/jfdctint.c \ ./libjpeg/jidctflt.c \ ./libjpeg/jidctfst.c \ ./libjpeg/jidctint.c \ ./libjpeg/jidctred.c \ ./libjpeg/jmemmgr.c \ ./libjpeg/jmemnobs.c \ ./libjpeg/jquant1.c \ ./libjpeg/jquant2.c \ ./libjpeg/jutils.c LOCAL_SRC_FILES += \ ./libyuv/source/compare_common.cc \ ./libyuv/source/compare_neon.cc \ ./libyuv/source/compare_posix.cc \ ./libyuv/source/compare_win.cc \ ./libyuv/source/compare.cc \ ./libyuv/source/convert_argb.cc \ ./libyuv/source/convert_from_argb.cc \ ./libyuv/source/convert_from.cc \ ./libyuv/source/convert_jpeg.cc \ ./libyuv/source/convert_to_argb.cc \ ./libyuv/source/convert_to_i420.cc \ ./libyuv/source/convert.cc \ ./libyuv/source/cpu_id.cc \ ./libyuv/source/format_conversion.cc \ ./libyuv/source/mjpeg_decoder.cc \ ./libyuv/source/mjpeg_validate.cc \ ./libyuv/source/planar_functions.cc \ ./libyuv/source/rotate_argb.cc \ ./libyuv/source/rotate_mips.cc \ ./libyuv/source/rotate_neon.cc \ ./libyuv/source/rotate_neon64.cc \ ./libyuv/source/rotate.cc \ ./libyuv/source/row_any.cc \ ./libyuv/source/row_common.cc \ ./libyuv/source/row_mips.cc \ ./libyuv/source/row_neon.cc \ ./libyuv/source/row_neon64.cc \ ./libyuv/source/row_posix.cc \ ./libyuv/source/row_win.cc \ ./libyuv/source/scale_argb.cc \ ./libyuv/source/scale_common.cc \ ./libyuv/source/scale_mips.cc \ ./libyuv/source/scale_neon.cc \ ./libyuv/source/scale_neon64.cc \ ./libyuv/source/scale_posix.cc \ ./libyuv/source/scale_win.cc \ ./libyuv/source/scale.cc \ ./libyuv/source/video_common.cc LOCAL_SRC_FILES += \ ./jni.c \ ./audio.c \ ./utils.c \ ./image.c \ ./video.c \ ./fake.c include $(BUILD_SHARED_LIBRARY)
- Compilar binarios independientes con NDK 13
- Error de vinculación de C ++ Firebase en el proyecto android
- Cómo utilizar bibliotecas nativas de 32 bits en un dispositivo Android de 64 bits
- No se pueden crear tutoriales de GStreamer con Android Studio
- Android NDK build, Método no se pudo resolver
- Android No se puede identificar el apk para variante de depuración de brazo y dispositivo
- Vinculación de la compilación de la biblioteca con ndk r10 en la compilación del proyecto con ndk r13 utilizando c ++ _ stl compartido
- ADVERTENCIA: ... / Android.mk: bibliotecas que no son del sistema en los indicadores de vinculador
- Android Flavors, ContentProviders, SyncAdapters y AccountManager
- Tiempo de respuesta de cambio de clase de Android Geocoder.