多分辨率图片;realm;ViewStub

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是拿来注入的,不是拿来替换的。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,381评论 25 708
  • 现在社会上流行保养,身体要保养,皮肤要保养,容貌要保养,甚至于衣服鞋子都要保养,但大家有没有想过心也要保养? 对于...
    祥和之光阅读 110评论 0 0
  • 在你安好的往昔, 我彻夜灌入事不关己的情歌, 如新上市的防盗门,封闭了气压, 如旧时代的拉绳电灯,触动了导线, 假...
    荒木懵猫阅读 348评论 0 1
  • 静殊从来话不多,喜欢独自静处,常常像一樽雕塑。不过以她这只知道一味迁就别人的性格,时不时也会像个话痨,因为她不忍心...
    沙扬海云阅读 56评论 0 0
  • 日落西山你不陪,东山再起你是谁?同甘共苦你不在,荣华富贵你不配! 真正的强者是,夜深人静了就把心掏出来自己缝缝补补...
    石川河女神阅读 161评论 0 0