java.lang.UnsatisfiedLinkError与all com.android.support libraries must use the exact same...问题的处理办法
2017-12-30 10:07
603 查看
此篇博客是博主在利用“融云”完成最简单即时通讯时遇到的问题,现已解决。
问题一:
TargetSdkVersion 为24及以上时,找不到libsqlite.so,导致连上无法连接服务器。
错误日志如下:
经过查阅后博主得知:
原因是7.0以后,Andorid不允许直接访问系统的私有so文件了。
两种解决方案:
一、把targetSdkVersion改小于24。
二、apk中带上需要的so文件,这儿是libsqlite.so
1.下载附件中的so文件,放到对应的文件夹下,如libs/armv7-abi/libsqlite.so,并注意你的gradle是否引用了这个目录,如 jniLibs.srcDirs = [‘libs’]
2.编译测试。
3.通过Android Studio的Analyze APK功能[Build -> Analyze APK…], 或直接解开apk包,查看是apk的lib目录下是否已包含libsqlite.so文件。
问题二:
如果引用的第三方库的支持库版本低于(或者不一致)app build.gradle中的支持库版本,可能会出现如下问题:
如下图:
去改第三方库所用的支持库版本比较麻烦,如果用的库很多的话工作量很大。这个时候我们可以考虑强制让所有模块都用相同的支持库版本。
在app build.gradle中添加:
其中,25.3.1就是你要使用的支持库版本号,你可以根据需要改成其它的。
问题一:
TargetSdkVersion 为24及以上时,找不到libsqlite.so,导致连上无法连接服务器。
错误日志如下:
java.lang.UnsatisfiedLinkError: dlopen failed: library "libsqlite.so" not found
经过查阅后博主得知:
原因是7.0以后,Andorid不允许直接访问系统的私有so文件了。
两种解决方案:
一、把targetSdkVersion改小于24。
二、apk中带上需要的so文件,这儿是libsqlite.so
1.下载附件中的so文件,放到对应的文件夹下,如libs/armv7-abi/libsqlite.so,并注意你的gradle是否引用了这个目录,如 jniLibs.srcDirs = [‘libs’]
2.编译测试。
3.通过Android Studio的Analyze APK功能[Build -> Analyze APK…], 或直接解开apk包,查看是apk的lib目录下是否已包含libsqlite.so文件。
问题二:
如果引用的第三方库的支持库版本低于(或者不一致)app build.gradle中的支持库版本,可能会出现如下问题:
all com.android.support libraries must use the exact same version specification(mixing versions can lead to runtime crashes)
如下图:
去改第三方库所用的支持库版本比较麻烦,如果用的库很多的话工作量很大。这个时候我们可以考虑强制让所有模块都用相同的支持库版本。
在app build.gradle中添加:
configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> def requested = details.requested if (requested.group == 'com.android.support') { if (!requested.name.startsWith("multidex")) { details.useVersion '25.3.1' } } } }
其中,25.3.1就是你要使用的支持库版本号,你可以根据需要改成其它的。
相关文章推荐
- 解决支持库版本兼容问题:all com.android.support libraries must use the exact same version specification
- 解决支持库版本兼容问题:all com.android.support libraries must use the exact same version specification
- All com.android.support libraries must use the exact same version specification 的解决方法
- All com.android.support libraries must use the exact same version specification
- all com.android.support libraries must use the exact same version specification
- Android Studio2.3 All com.android.support libraries must use the exact same version specification...
- Android Studio2.3 All com.android.support libraries must use the exact same version specification..
- Exception:All com.android.support libraries must use the exact same version specification
- All com.android.support libraries must use the exact same version specification解决
- 使用android OpenGL时出现的java.lang.IllegalArgumentException: Must use a native order direct Buffer错误问题解决
- android4.1 JELLY_BEAN:All WebView methods must be called on the same thread[问题已解决]
- [android引用他人包出现的错误]All versions of the libraries must be the same at this time.以及It is indirectly re
- Android项目导入出现The type java.lang.Object cannot be resolved.问题解决办法!!
- Android项目导入出现The type java.lang.Object cannot be resolved.问题解决办法!! .
- 【Android】java.lang.AssertionError use looper thread, must call Looper.prepare() first!异常分析
- 开发中碰到的问题:java.lang.NoClassDefFoundError: com.baidu.location.LocationClient的解决办法
- [原][Android]All WebView methods must be called on the same thread.
- Cause by:All WebView methods must be called on the same thread[问题已解决]
- java.lang.Throwable: Warning: A WebView methods must be called on the same thread.
- android4.1 JELLY_BEAN:All WebView methods must be called on the same thread[问题已解决]