title: Automatically solve Android build Error:Frame pixels must be either solid or transparent (not intermediate alphas). - Found at pixel #4 along top edge
body: <p>Android Studio (using SDK 19, 21 or 22) shows an error that Eclipse ADT (using SDK 19) does not:</p>
  
  <blockquote>
    <p>Error:9-patch image D:\Workspaces....\res\drawable-hdpi\btn_bg_common_press.9.png malformed.
    Error:Frame pixels must be either solid or transparent (not intermediate alphas). - Found at pixel #4 along top edge.</p>
  </blockquote>
  
  <p>Or <a href="https://stackoverflow.com/questions/28940476/android-gradle-build-errorticks-in-transparent-frame-must-be-black-or-red">another error</a>:</p>
  
  <blockquote>
    <p>Error:Ticks in transparent frame must be black or red.</p>
  </blockquote>
  
  <p>both within <code>aapt</code></p>
  
  <blockquote>
    <p>Error:Error: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'E:\Android\sdk-Android-Studio\build-tools\19.1.0\aapt.exe'' finished with non-zero exit value 42</p>
  </blockquote>
  
  <p><img src="https://i.stack.imgur.com/euMip.png" alt="btn_bg_common_press.9.png"></p>
  
  <p>Example of file is above, but there are 20+ such files that worked well.</p>
  
  <p><strong>How do I make Android Studio or Gradle skip this error and not fail without having to modify those files one-by-one?</strong></p>
  
  <p>If it is not possible with Gradle, what command-line tool could I use to replace all transparent pixel with non-transparent?</p>
  
  <p>The build.gradle file for the application module (where resources are) is below.</p>
  
  <p>I have tried both with <a href="http://developer.android.com/tools/revisions/platforms.html" rel="nofollow noreferrer">SDK 19 and SDK 21</a> and <a href="http://developer.android.com/tools/revisions/build-tools.html" rel="nofollow noreferrer">build tools 19.1, 21.1.2, 22</a>.</p>
  
  <p>A similar issue on AOSP, <a href="https://code.google.com/p/android/issues/detail?id=159464" rel="nofollow noreferrer">Issue 159464: Android studio: mergeDebugResources FAILED when importing Eclipse project</a>.</p>
  
  <pre><code>buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:1.1.+'
      }
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  
  //---
  task wrapper(type: Wrapper) {
      gradleVersion = '2.2.1'
  }
  
  apply plugin: 'com.android.application'
  
  dependencies {
      compile fileTree(dir: 'libs', include: '*.jar')
      compile project(':afinal')
      compile 'com.android.support:appcompat-v7:19.0.+'
      //compile 'com.android.support:appcompat-v7:21.0.+'
  }
  
  //---
  android {
      sourceSets {
          main {
              manifest.srcFile 'AndroidManifest.xml'
              res.srcDirs = ['res']
              assets.srcDirs = ['assets']
          }
      }
  
      compileSdkVersion 19
      buildToolsVersion "19.1.0"
      //compileSdkVersion 21
      //buildToolsVersion "21.1.2"
      //compileSdkVersion Integer.parseInt(project.COMPILE_SDK_VERSION)
      //buildToolsVersion project.BUILD_TOOLS_VERSION
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
              zipAlignEnabled true
              //signingConfig signingConfigs.release
          }
          debug {
              zipAlignEnabled true
          }
      }
  
      lintOptions {
          //checkReleaseBuilds false
          // Or, if you prefer, you can continue to check for errors in release builds,
          // but continue the build even when errors are found:
          abortOnError false // false also required by https://wiki.jenkins-ci.org/display/JENKINS/Android+Lint+Plugin
      }
  }//android
  </code></pre>
  
  <p>Android Gradle plugins sources are at <a href="https://android.googlesource.com/platform/tools/build/+/master" rel="nofollow noreferrer">https://android.googlesource.com/platform/tools/build/+/master</a>.</p>