Unsatisfiedlinkerror in android (eclipse)

后端 未结 3 1950
北恋
北恋 2021-01-01 00:36

I am trying to run a simple jni code in Android, But all I am getting Unsatisfiedlinkerror .

Here is my Java code:

package com.lipcap;

import androi         


        
3条回答
  •  猫巷女王i
    2021-01-01 01:05

    This isn't really been called quite right...

    Try:

    package com.lipcap;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TextView;
    
    public class MainActivity extends Activity {
        /** Called when the activity is first created. */
    
        TextView a;
    
        public native String sniff();
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
    
            a=new TextView(this);
    
            String b = sniff(); 
    
            a.setText(b);
    
            setContentView(a);
        }
    
        static{
            System.loadLibrary("native");
        }
    
    }
    

    Lastly... is this in your Android.mk?

    LOCAL_MODULE    := native
    

提交回复
热议问题