1
Unsatisfied Link Error
が私のAsyncTask doInBackground
メソッドにあります。私は少しの研究をしましたが、エラーを受け取った人は誰もがAndroid NDKの何かを乱していたようです。私はPocketSphinx
と呼ばれる第三者のライブラリを使用していますが、NDKをまったく混乱させる必要はありませんでした。どのようにエラーが表示されますか?ここでポケットスフィンクスのAndroid Unsatisfied Link Error
がエラーである:ここでは
FATAL EXCEPTION: AsyncTask #1
Process: fr.tvbarthel.games.chasewhisply, PID: 22304
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-support-annotations-24.2.0_eab48403ac91a1482086a437a891c467c02a8655-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-pocketsphinx-android-5prealpha-nolib_04ad45026efd8df9bba8dff935eb8bb91a2820d9-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-library-2.4.0_52ddc41d753f7a07db2405d0585cefbed932cc49-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-internal_impl-24.2.0_b6e1396bc2afeb25dc6fa9a5a32673830d1955c4-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-internal_impl-24.2.0_a66e98338b0c6c83a42c414e6aad64e64a2d66dc-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-internal_impl-24.2.0_830c2f91b22bcd7534d43f134a4a72d3ba734fef-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-internal_impl-24.2.0_64c0dff23bdb8b8496807610b026274dbc7e94c1-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-internal_impl-24.2.0_47b57223bb396e6ca2dce0755daf4a5389167e81-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-com.google.android.gms-play-services-4.3.23_0890364ef8f99fb395bfe174fe1a829b1a54ab63-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-com.android.support-support-v4-24.2.0_218b69aab748cb26784534005e4392fe1f774581-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-com.android.support-support-media-compat-24.2.0_9ca84d65b8a4f2912ff6ee9167099802869b1c88-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-com.android.support-support-fragment-24.2.0_ef5bfc7a750e8c7cc586a3f17a322d4434077fe5-classes.dex", dex file "/data/data/fr.tvbarthel.games.chasewhisply/files/instant-run/dex/slice-com.android.support-support-core-utils-24.2.0_cfa9f678f7dba50890bb4bb8cda71ed4b36ef86d-classes.dex", dex file "/data/data/fr.tvbar
は私のコードは
あるpublic class PocketSphinx implements RecognitionListener {
private static final String MENU_SEARCH = "menu";
private SpeechRecognizer recognizer;
private VoiceListener voiceListener;
public PocketSphinx(Context context) {
runRecognizerSetup(context);
}
public void startListening() {
recognizer.startListening(MENU_SEARCH, 2000);
}
public void stopListening() {
recognizer.stop();
}
public void runRecognizerSetup(final Context context) {
// Recognizer initialization is a time-consuming and it involves IO,
// so we execute it in async task
new AsyncTask<Void, Void, Exception>() {
@Override
protected Exception doInBackground(Void... params)
{
try
{
Assets assets = new Assets(context);
File assetDir = assets.syncAssets();
setupRecognizer(assetDir);
Log.d("POCKET SPHINX", "Set up done correctly");
}
catch (IOException e)
{
return e;
}
return null;
}
@Override
protected void onPostExecute(Exception e) {
super.onPostExecute(e);
startListening();
}
}.execute();
}
private void setupRecognizer(File assetsDir) throws IOException {
// The recognizer can be configured to perform multiple searches
// of different kind and switch between them
recognizer = SpeechRecognizerSetup.defaultSetup()
.setAcousticModel(new File(assetsDir, "en-us-ptm"))
.setDictionary(new File(assetsDir, "cmudict-en-us.dict"))
.setRawLogDir(assetsDir) // To disable logging of raw audio comment out this call (takes a lot of space on the device)
.setKeywordThreshold(1e-45f) // Threshold to tune for keyphrase to balance between false alarms and misses
.setBoolean("-allphone_ci", true) // Use context-independent phonetic search, context-dependent is too slow for mobile
.getRecognizer();
recognizer.addListener(this);
File Grammar = new File(assetsDir, "npd3.gram");
recognizer.addGrammarSearch(MENU_SEARCH, Grammar);
}
}