Futronic Reader Error:java.lang.UnsatisfiedLinkError:Native Method FutronicInitialize()

时间:2016-04-06 11:20:48

标签: java android

我正在将Android应用与Futronic Fingerprint Reader集成。尝试使用class FutronicEnrollment(来自提供的示例)实例化new FutronicEnrollment时遇到了麻烦。

确切错误如下所述

 java.lang.UnsatisfiedLinkError: No implementation found for int 
futronictech.SDKHelper.FutronicSdkBase.FutronicInitialize() 
(tried Java_futronictech_SDKHelper_FutronicSdkBase_FutronicInitialize 
and Java_futronictech_SDKHelper_FutronicSdkBase_FutronicInitialize__)

调用Futronic注册类的方法如下:

    public void StartEnrollWithUsername(String szFingerName, int sdkVersion) {
    try
    {
        if (!usb_host_ctx.ValidateContext()) {
            throw new Exception("Can't open USB device");
        }

        // CreateFile( szFingerName );
        m_OperationObj = new DbRecord();
        ((DbRecord) m_OperationObj).setUserName(szFingerName);
        m_Operation = new FutronicEnrollment((Object) usb_host_ctx);
        m_Operation.FutronicInitialize();
        // Set control properties
        m_Operation.setFakeDetection(true);
        m_Operation.setFFDControl(true);
        m_Operation.setFFDControl(true);
        ((FutronicEnrollment) m_Operation)
                .setMIOTControlOff(true);
        ((FutronicEnrollment) m_Operation).setMaxModels(Integer
                .parseInt(maxFram));
        switch (sdkVersion) {
            case 0:
                m_Operation.setVersion(VersionCompatible.ftr_version_previous);
                break;

            case 1:
                m_Operation.setVersion(VersionCompatible.ftr_version_current);
                break;
            default:
                m_Operation.setVersion(VersionCompatible.ftr_version_compatible);
                break;
        }
        // start enrollment process
        ((FutronicEnrollment) m_Operation).Enrollment(this);
    } catch (Exception e) {
        Toast.makeText(getActivity().getApplicationContext(), "Cannot start enrollment operation.\nError description: "
                + e.getMessage(), Toast.LENGTH_LONG).show();
        m_Operation = null;
        m_OperationObj = null;
        usb_host_ctx.CloseDevice();
    }
}

Futronic注册课程如下:

   /*
 * FutronicEnrollment.java
 *
 */

package futronictech.SDKHelper;

/**
 * The "Enrollment operation" class
 */
public class FutronicEnrollment extends FutronicSdkBase implements Runnable
{
    protected static int MinModelsValue = 1;
    protected static int MaxModelsValue = 10;
    protected static int DefaultModelsValue = 5;

    /**
     * The FutronicEnrollment class constructor.
     * Initialize a new instance of the FutronicEnrollment class.
     *
     * @exception FutronicException Error occurs during SDK initialization. 
     * To get error code, see method <code>getErrorCode</code> of FutronicException
     * class.
     */
    public FutronicEnrollment(Object ctx)
        throws FutronicException
    {
        super();
        m_bMIOTControlOff = true;
        m_Template = null;
        m_Quality = 0;
        m_MaxModels = DefaultModelsValue;
        SetIoCtx(ctx);
    }

    /**
     * This function starts the enrollment operation.
     *
     * The enrollment operation starts in its own thread. To interact with the 
     * enrollment operation caller must implement the <code>IEnrollmentCallBack</code>
     * interface and should specify it. The interface methods denote following:
     * <table>
     * <thead>
     *  <tr>
     *      <td>Method</td>
     *      <td>Description</td>
     *  </tr>
     * </thead>
     * <tr>
     *      <td>OnPutOn</td>
     *      <td>Invitation for touching the fingerprint scanner surface.</td>
     *  </tr>
     * <tr>
     *      <td>OnTakeOff</td>
     *      <td>Proposal to take off a finger from the scanner surface.</td>
     *  </tr>
     * <tr>
     *      <td>UpdateScreenImage</td>
     *      <td>The "Show the current fingerprint image" event.</td>
     *  </tr>
     * <tr>
     *      <td>OnFakeSource</td>
     *      <td>The "Fake Finger Detected"  event. This event raises only if 
     *      <code>FakeDetection</code> and <code>FFDControl</code> properties are 
     *      <code>true</code>.</td>
     *  </tr>
     * <tr>
     *      <td>OnEnrollmentComplete</td>
     *      <td>This event is signaled when the enrollment operation is completed.
     *      If the operation is completed successfully, you may get a template.</td>
     *  </tr>
     * </table>
     * If the enrollment operation is completed successfully, you may get a 
     * template. The next call of the enrollment operation removes the last 
     * created template.
     *
     * @param callBack reference to call back interface (can not be NULL)
     *
     * @exception IllegalStateException the object is not in an appropriate 
     * state for the requested operation or the object disposed.
     *
     * @exception NullPointerException a null reference parameter callBack is 
     * passed to the function.
     */
    public void Enrollment( IEnrollmentCallBack callBack )
        throws IllegalStateException, NullPointerException
    {
        CheckDispose();
        if( m_State != EnrollmentState.ready_to_process )
            throw new IllegalStateException( "The object is not in an appropriate state for the requested operation" );

        if( callBack == null )
            throw new NullPointerException( "A null reference parameter callBack is passed to the function." );
        m_State = EnrollmentState.process_in_progress;
        m_CallBack = callBack;
        m_bCancel = false;
        // run new thread
        m_WorkedThread = new Thread( this, "Enrollment operation" );
        m_WorkedThread.start();
    }

    /**
     * get the MIOT mode setting
     *
     * @exception IllegalStateException the object disposed.
     */
    public boolean getMIOTControlOff()
        throws IllegalStateException
    {
        CheckDispose();
        return m_bMIOTControlOff;
    }

    /**
     * Enable or disable the MIOT mode
     *
     * Set to <code>true</code>, if you want to enable the MIOT mode.
     *
     * @param bMIOTControl new value
     *
     * @exception IllegalStateException the object is not in an appropriate 
     * state for the requested operation or the object disposed.
     */
    public void setMIOTControlOff( boolean bMIOTControlOff )
        throws IllegalStateException
    {
        CheckDispose();
        if( m_State != EnrollmentState.ready_to_process )
            throw new IllegalStateException( "The object is not in an appropriate state for the requested operation" );
        m_bMIOTControlOff = bMIOTControlOff;
    }

    /**
     * get max number of models in one template.
     *
     * @exception IllegalStateException the object disposed.
     */
    public int getMaxModels()
        throws IllegalStateException
    {
        CheckDispose();
        return m_MaxModels;
    }

    /**
     * Set max number of models in one template.
     *
     * This value must be between 3 and 10.
     *
     * @param MaxModels new value
     *
     * @exception IllegalStateException the object is not in an appropriate 
     * state for the requested operation.
     * @exception IllegalStateException the object disposed.
     * @exception IllegalArgumentException a method has been passed an 
     * inappropriate argument MaxModels.
     */
    public void setMaxModels( int MaxModels )
        throws IllegalStateException, IllegalArgumentException
    {
        CheckDispose();
        if( m_State != EnrollmentState.ready_to_process )
            throw new IllegalStateException( "The object is not in an appropriate state for the requested operation" );

        if( MaxModels < 1 || MaxModels > 10 )
            throw new IllegalArgumentException( "The value of argument 'MaxModels' is outside the allowable range of values.");

        m_MaxModels = MaxModels;
    }

    /**
     * Returns the template of the last enrollment operation.
     *
     * Returns a copy of template. If the last enrollment operation is 
     * unsuccessful, the return code is null.
     *
     * @exception IllegalStateException the object is not in an appropriate 
     * state for the requested operation. The enrollment operation is started. 
     * @exception IllegalStateException the object disposed.
     */
    public byte[] getTemplate()
        throws IllegalStateException
    {
        CheckDispose();
        if( m_State != EnrollmentState.ready_to_process )
            throw new IllegalStateException( "The object is not in an appropriate state for the requested operation. The enrollment operation is started" );
        if( m_Template == null )
            return null;
        return m_Template.clone();
    }

    /**
     * Return the quality of the template.
     *
     * Return value may be one of the following: 1 (the lowest quality) to  10 
     * (best quality). If the enrollment operation is unsuccessful or was not 
     * started, the return value is 0.
     *
     * @exception IllegalStateException the object is not in an appropriate 
     * state for the requested operation. The enrollment operation is started. 
     * @exception IllegalStateException the object disposed.
     */
    public int getQuality()
    {
        CheckDispose();
        if( m_State != EnrollmentState.ready_to_process )
            throw new IllegalStateException( "The object is not in an appropriate state for the requested operation. The enrollment operation is started" );
        return m_Quality;
    }

    /**
     * The main thread of the enrollment operation.
     */
    public void run()
    {
        int nResult = RETCODE_INTERNAL_ERROR;
        try
        {
            synchronized( m_SyncRoot )
            {
                m_Template = null;
                m_Quality = 0;
                nResult = FutronicEnroll(GetIoCtx());
            }
        }
        finally
        {
            m_State = EnrollmentState.ready_to_process;
            ((IEnrollmentCallBack)m_CallBack).OnEnrollmentComplete( nResult == RETCODE_OK, nResult );
        }
    }

    /**
     * The MIOT mode setting.
     * You cannot modify this variable directly. Use the <code>getMIOTControl</code>
     * and <code>setMIOTControl</code> methods.
     * The default value is <code>false</code>.
     */
    private boolean     m_bMIOTControlOff;

    /**
     * The template of the last enrollment operation.
     * You cannot modify this variable directly. Use the <code>getTemplate</code> method.
     */
    private byte[]      m_Template;

    /**
     * Estimation of a template quality in terms of recognition:
     * 1 corresponds to the worst quality, 10 denotes the best.
     */
    private int         m_Quality;

    /**
     * Max number of models in one template. This value must be between 3 and 10.
     */
    private int         m_MaxModels;

}

注意: 该应用已与扫描器

进行通信

对此的任何帮助都将受到高度赞赏

1 个答案:

答案 0 :(得分:0)

您正试图在futronictech.SDKHelper.FutronicSdkBase库中使用jni函数,该函数不存在,m_Operation.FutronicInitialize();

我发现这段代码与你的代码一样,没有调用m_Operation.FutronicInitialize();

https://github.com/Kibnelson/Android-pharmacy-fingerprint/blob/master/src/mkumbusha/android/main/FingerprintScannerActivity.java

我认为如果没有这一行m_Operation.FutronicInitialize();,您的代码就可以运行。

希望帮助