How to resolve bug of:uncompiled PNG file passed as argument. Must be compiled first into .flat file.

cover from :https://stackoverflow.com/questions/45954209/issues-with-resources-generated-by-react-in-android-studio-3

I recently upgraded to Android Studio 3

gradle plugin: 3.0.0-beta2
gradle: 4.1

In our project we use: "react-native": "0.46.4" with the

codepush plugin.

Building:

gradlew assembleStagingDebug

works just fine, but as soon as I try to build production:

gradlew assembleProductionRelease

I get an error caused by resources that are created by react in the processProductinoReleaseResources task:

Issues:
 - ERROR: /Users/user/react/android/app/build/intermediates/res/merged/production/release/drawable-hdpi/node_modules_reactnavigation_src_views_assets_backicon.png uncompiled PNG file passed as argument. Must be compiled first into .flat file.
 - ERROR:  failed parsing overlays
        at com.android.builder.internal.aapt.v2.AaptV2Jni.buildException(AaptV2Jni.java:154)

In my conquest against this issue I tried it with disabling proguard like:

buildTypes {
        release {
            debuggable true
            minifyEnabled false
            shrinkResources false
        }
        debug {
            debuggable true
            minifyEnabled false
            println proguardFiles
        }
    }

HOW TO SOLVE IT?

In your gradle.properties file add following lines:

classpath 'com.android.tools.build:gradle:3.0.0'
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip
android.enableAapt2=false

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

推荐阅读更多精彩内容

  • 我们是这样的: 面对陌生又充满探险的世界呱呱坠地时,我们吸到了这个世界第一口氧气,嚎啕大哭,而身旁的人却喜...
    雨瑟清清阅读 278评论 0 0
  • 与其期望遇到一个谁,不如指望你自己能吸引什么样的人; 与其指望每次失落的时候会有正能量出现温暖你,不如指望...
    梦戏笔谈阅读 202评论 0 1
  • 听了一一老师的POA的课程,学到很多东西,以下是我学到的内容,分享给大家。 一一老师那刚开始讲的时候,先让大家做了...
    陈玉冬阅读 1,056评论 0 2
  • 本期预测: 独胆:6 二胆:26 三胆:026 五码组合:02468(含组三) 精选:602,648,684,40...
    德嘉伟业阅读 217评论 0 0