最近在做讯飞语音开发的时候导入库文件出现了失败的情况,记录一下情况
07-07 14:42:43.641 8541-8541/com.iflytek E/MscSpeechLog: loadLibrary msc error:java.lang.UnsatisfiedLinkError: com.android.tools.fd.runtime.IncrementalClassLoader$DelegateClassLoader[DexPathList[[dex file "/data/data/com.iflytek/files/instant-run/dex/slice-support-annotations-23.3.0_41736580aaf257026257a53d48aa21efac40eec4-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-internal_impl-23.3.0_84c0c5132a4d58880386af8176a099ede691c9f3-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-com.android.support-support-vector-drawable-23.3.0_a42e104b8ec68b5fc7ad80944b2d2e59525b8b03-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-com.android.support-support-v4-23.3.0_a960364d871d59a60465924f6de5cffe96520597-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-com.android.support-appcompat-v7-23.3.0_415dcaf262706069869c9819b9ba18fbbb5f25ed-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-com.android.support-animated-vector-drawable-23.3.0_ca63d20c70a3baefbef88623ed792973decf010e-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-Sunflower_ce7018b0e1f62ff092295fa9bf43080425d3dbae-classes.dex", dex file "/data/data/com.iflytek/files/instant-run/dex/slice-Msc_df498062e1ff4c7272f0535d9a1aea6269802950-classes.dex"],nativeLibraryDirectories=[/vendor/lib64, /system/lib64, /vendor/lib64, /system/lib64]]] couldn't find "libmsc.so"
07-07 14:42:43.641 8541-8541/com.iflytek D/MscSpeechLog: MSC ifly ver: true
07-07 14:42:43.658 8541-8541/com.iflytek E/PushFactory: getPushInstance not found push instance.
07-07 14:42:43.662 8541-8541/com.iflytek D/MPlugin: createInstance(): Begin = 58318444
07-07 14:42:43.662 8541-8541/com.iflytek D/MPlugin: create Instance (two parameters) with : com.mediatek.common.telephony.IOnlyOwnerSimSupport
07-07 14:42:43.662 8541-8541/com.iflytek D/MPlugin: Clazz exists on mapping table : false
07-07 14:42:43.662 8541-8541/com.iflytek E/MPlugin: Unsupported class: com.mediatek.common.telephony.IOnlyOwnerSimSupport
07-07 14:42:43.662 8541-8541/com.iflytek D/MPlugin: createInstance(): End = 58318444
07-07 14:42:43.669 8541-8541/com.iflytek D/MscSpeechLog: DC init enable=null
07-07 14:42:43.669 8541-8541/com.iflytek D/MscSpeechLog: MSC ifly ver: true
07-07 14:42:43.670 8541-8541/com.iflytek D/MscSpeechLog: DC init enter.
07-07 14:42:43.670 8541-8541/com.iflytek D/MscSpeechLog: DC getEnable enter.
07-07 14:42:43.670 8541-8541/com.iflytek D/MscSpeechLog: DC getEnable static value=true
07-07 14:42:43.670 8541-8541/com.iflytek D/MscSpeechLog: getMscParameter enter key=idc
07-07 14:42:43.670 8541-8541/com.iflytek E/MscSpeechLog: getMscParameter MSC is not loaded
反正就是找不到libmsc.so文件,我在网上找了一下资料,发现eclipse 和 Android studio 的默认lib路径是不一样的
eclipse的默认目录是在与 src 文件夹平级的libs目录下的,我在 Android studio 也一样建了一个libs文件夹将libmsc.so文件放进去就报了上面的错误。
因为Android studio 的默认目录是main文件夹下的jniLibs。
解决方法是将包含libmsc.so文件的armeabi文件夹放到jniLibs文件夹里
我用的是另一个方法:在gradle文件里建一个引用
第一次写博客,主要是备忘,感觉我做的上一个Launcher和Setting修改的项目就快忘了,今天有点时间先把最近遇到的问题记录一下