我正在尝试使用Bypass,一个降价库,用于我的Android应用。我已设法将其实现到我的android项目并能够新功能。但是,在我实现了库并尝试运行它的函数后,我收到了这个错误:
Process: com.test.ndktest, PID: 24196
java.lang.UnsatisfiedLinkError: No implementation found for in.uncod.android.bypass.Document in.uncod.android.bypass.Bypass.processMarkdown(java.lang.String) (tried Java_in_uncod_android_bypass_Bypass_processMarkdown and Java_in_uncod_android_bypass_Bypass_processMarkdown__Ljava_lang_String_2)
at in.uncod.android.bypass.Bypass.processMarkdown(Native Method)
at in.uncod.android.bypass.Bypass.markdownToSpannable(Bypass.java:88)
at in.uncod.android.bypass.Bypass.markdownToSpannable(Bypass.java:84)
at com.test.ndktest.MainActivity.onCreate(MainActivity.java:23)
at android.app.Activity.performCreate(Activity.java:5958)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
at android.app.ActivityThread.access$800(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5696)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
我已按照其implement说明使用NDK和boost库导入项目。 (在android studio中的方式)
感谢。
这是我的主要活动文件
public class MainActivity extends AppCompatActivity {
static {
System.loadLibrary("bypass");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView text=(TextView)findViewById(R.id.textview);
Bypass bypass = new Bypass();
String markdownString = "#Markdown!";
CharSequence string = bypass.markdownToSpannable(markdownString);
text.setText(string);
text.setMovementMethod(LinkMovementMethod.getInstance());
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
//public native String getStringFromNative();
}