2016-09-29 28 views
1

我使用rn 0.33和之後./android & & gradlew assembleRelease我得到app-debug.apk和app-release.apk。App-release.apk不包含圖像

如果我用包裝程序在我的設備上安裝debug.apk,我的應用程序中顯示的所有圖像都正確,但是在release.apk中,所有圖像都消失了。

任何想法?

+0

你是什麼意思的圖像都不見了?您能否準確地顯示日誌,代碼和所有內容的問題? – octohedron

回答

0

如果它在調試中起作用,但它不再適用於發佈,可能是ProGuard的一個問題。

這些圖像是不是gifs?

默認情況下,Android不支持GIF和WebP。

根據您的應用需求,您需要在​​中添加一些可選模塊。

dependencies { 
    // If your app supports Android versions before Ice Cream Sandwich (API level 14) 
    compile 'com.facebook.fresco:animated-base-support:0.11.0' 

    // For animated GIF support 
    compile 'com.facebook.fresco:animated-gif:0.11.0' 

    // For WebP support, including animated WebP 
    compile 'com.facebook.fresco:animated-webp:0.11.0' 
    compile 'com.facebook.fresco:webpsupport:0.11.0' 

    // For WebP support, without animations 
    compile 'com.facebook.fresco:webpsupport:0.11.0' 
} 

另外,如果你使用GIF使用ProGuard,你將需要在proguard-rules.pro添加此規則:

-keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl { 
    public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier); 
} 

GIF and WebP support on Android.