0

I am trying to integrate Google Signin in my Android App. I am facing issue with building apk when I include Google Services Dependencies. Below are my gradle files and error log. The google services lib is also prompting me to use gradle-wrapper 2.10 and not 2.8

PROJECT LEVEL GRADLE FILE:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
        classpath 'com.google.gms:google-services:2.0.0-alpha5'
    }
}

allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

APP LEVEL GRADLE FILE:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.jaldirecharge"
        minSdkVersion 9
        targetSdkVersion 23
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
        }
    }

    useLibrary 'org.apache.http.legacy'
}

dependencies {
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:support-v4:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.mcxiaoke.volley:library:1.0.6'
    compile 'com.google.code.gson:gson:2.4'
    compile 'com.google.android.gms:play-services-auth:8.3.0'
    compile files('libs/gcm.jar')
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile files('libs/socialauth-4.3.jar')
    compile 'com.facebook.android:facebook-android-sdk:4.9.0'
    compile files('libs/socialauth-android-3.0.jar')
    compile files('libs/universal-image-loader-1.8.3.jar')
}

ERROR LOGS:

Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk490Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
:app:generateDebugResources
:app:mergeDebugResources

AAPT err(Facade for 1282826090) : No Delegate set : lost message:libpng error: Not a PNG file AAPT err(Facade for 1543523483) : No Delegate set : lost message:libpng error: Not a PNG file AAPT: libpng error: Not a PNG file AAPT: libpng error: Not a PNG file :app:mergeDebugResources FAILED Error:Execution failed for task ':app:mergeDebugResources'.

Crunching Cruncher loader.png failed, see logs Information:BUILD FAILED Information:Total time: 9.017 secs Information:1 error Information:0 warnings Information:See complete output in console

Sumit
  • 401
  • 2
  • 6
  • 21
  • okay,I found the solution finally. Pls refer to this link: [http://stackoverflow.com/questions/30393726/imported-projects-give-error-in-android-studio-1-2-1-1](http://stackoverflow.com/questions/30393726/imported-projects-give-error-in-android-studio-1-2-1-1) – Addison Apr 05 '16 at 09:45

5 Answers5

7

You can disable it in your build.gradle:

android { 
    ....
    aaptOptions {
        cruncherEnabled = false
    }
    ....
}
anthorlop
  • 1,771
  • 1
  • 11
  • 11
  • 1
    In my case this solution work fine. Obviously the most recommended solution would be to avoid this problem with correct PNG images but this also works.You can check it in https://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.AaptOptions.html – anthorlop Dec 19 '16 at 10:43
6

Shahar has given right answer, only point I would like to add in is-

I had hundred+ images in my project and checking every image was not possible, so what I did is used a tool to convert all of them in PNG at a time. I am MAC user so I used Preview App. I found one of the image was saved as PNG but not png file.

Sumit
  • 401
  • 2
  • 6
  • 21
  • For those who user Windows, I used http://www.libpng.org/pub/png/apps/pngcheck.html and opened up the directory where my files are and used this command at COMMAND LINE
    "E:\PngCheck\pngcheck.exe *.png" and it shows like this OK: patient_box.png (325x75, 32-bit RGB+alpha, non-interlaced, 80.2%). patient_list_box.png this is neither a PNG or JNG image nor a MNG stream ERROR: patient_list_box.png". I then used the SnagIt converter to convert that file and save it as .png and then the Android studio was able to compile without any problems. So, GOOD LUCK, Charlie... :)
    – Vincy Apr 18 '16 at 11:53
1

There is some problem with your png file in the resource folder. How and where you got the PNG file? it could be corrupted.

try the following on the png with the issue:

Open it in an editor saved it as png. without renaming the file name. Copy-paste the .png image into the drawable folder.

Shahar
  • 3,692
  • 4
  • 25
  • 47
0

simply move the project folder because its name is too long and open it again with android studio

Nur Amsyari
  • 23
  • 2
  • 10
0

Moving the project folder into my workspace and opening it again worked for me.

MbaiMburu
  • 875
  • 1
  • 10
  • 19