Cocos2d-x 2.x Android Libpng Vulnerability fix

If you receive the following error on Google Play Developer console:

Please migrate your app(s) to libpng v1.0.66, v.1.2.56, v.1.4.19, v1.5.26 or higher as soon as possible and increment the version number of the upgraded APK. Beginning Sep 17, 2016, Google Play will block publishing of any new apps or updates that use vulnerable versions of libpng. Your published app version will remain unaffected, however any updates to the app will be blocked unless they address this vulnerability.

https://support.google.com/faqs/answer/7011127

A simple fix is to extract the following zip file into your “cocos2dx\platform\third_party\android\prebuilt” folder:

Download the fix from here:
libpng_fix.zip for Cocos2d-x 2.x

And change “Android.mk” file under “cocos2dx” folder:

Change:
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libpng_static

to
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libzlib_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libpng_static

Change:
$(call import-module,libpng)

to:
$(call import-module,libzlib)
$(call import-module,libpng)

You are also invited to checkout our games and apps:
Bengigi Apps and Games

 
Add a comment

Comments (8)

  1. Pooja, June 17, 2016
    Did you try this ? Did this worked ? Reply
    • Obg1, June 19, 2016
      Should work, I got it to compile but didn't have time to run my app Reply
  2. Florian CHAUX, June 20, 2016
    It doesn't work for me : cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a(pngrutil.o):pngrutil.c:function png_inflate_claim: error: undefined reference to 'inflateReset2' cocos2dx/platform/third_party/android/prebuilt/libpng/libs/armeabi/libpng.a(pngrutil.o):pngrutil.c:function png_decompress_chunk.constprop.5: error: undefined reference to 'inflateReset2' It seems to be an incompatibility between zlib and libpng provided Reply
    • Obg1, June 21, 2016
      Please follow the instructions and add the zlib library Reply
  3. Ricardo, June 21, 2016
    I followed all instructions, including adding zlib. It compiled for x86, but failed for armeabi and armeabi-v7a. For both architectures the error was "undefined reference to 'inflateReset2'". Reply
  4. itzo, June 22, 2016
    Your libpng_fix does not work! I am using cocos2dx 2.1.5, NDK r8e. Android app compiles without errors, but when I extract the APK and run on device, app's graphics "go background" and do not display properly. I cannot publish this to Google Play to see if the warning would disappear, but clearly something is off! Note: Added libzlib as well and followed the instructions for the Android.mk file inside cocos2dx folder. Reply
  5. Cory Trese, June 27, 2016
    Where did these files come from? Can you share the build settings you use, or the original source? Did they come from a later cocos2d-x package? Reply
    • Obg1, June 27, 2016
      I copy the one usd in the latest Cocos2d-x version. It works with my game "Run Cow Run". No more png warning Reply

Add a comment

Top
(it will not be shared)