多分辨率图片;realm;ViewStub

2016-11-19  本文已影响0人  小山包

1.Android Studio多分辨率图片导入

Android Studio使用一张图片生成各个分辨率相应的图片


Screen Shot 2016-11-18 at 10.43.35 AM.png

按这里的操作,然后选中图片生成就可以了。

2.realm的一个坑

Couldn’t load “librealm-jni.so”

If your app uses other native libraries that don’t ship with support for 64-bit architectures, Android will fail to load Realm’s librealm-jni.so file on ARM64 devices. This is because Android cannot load 32-bit and 64-bit native libraries concurrently. The best solution would be to have all libraries provide the same set of supported ABIs, but sometimes that may not be doable if you are using a 3rd-party library. See VLC and Realm Library conflicts.

The workaround to this issue is to exclude Realm’s ARM64 library from the APK file by adding the following code to the app’s build.gradle. You can refer to Mixing 32- and 64-bit Dependencies in Android for more information.

概括来说跟jni有关,如果一个app指定了只使用32位架构,且引用了不止一个.so文件,so文件里又有的是64位有的是32位的话,就会出现这个问题。realm官方提供了一个解决办法,但是感觉不是很好,所以realm暂时不会去用了。

android {
    //...
    packagingOptions {
        exclude "lib/arm64-v8a/librealm-jni.so"
    }
    //...
}

3.关于ViewStub

ViewStub是拿来注入的,不是拿来替换的。

上一篇下一篇

猜你喜欢

热点阅读