2015-11-21 12 views
8

Ich habe mehrmals versucht, Android Studio Build-Tools nach 1.3.1 zu aktualisieren, aber ich habe immer mit diesem libpng Fehler enden. Ich löste einen der Fehler, indem ich eine Maven-Abhängigkeit vollständig entfernte (da die Konsole auf genau dort zeigte, wo sich die Problemdatei befand), aber jetzt stecke ich mit dem gleichen Fehler und keinem Zeiger darauf, wo die Problemdatei ist. Fehle ich etwas? Hier ist das gradle Konsolenprotokoll:libpng Fehler: Keine PNG-Datei

Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources] 

Configuration on demand is an incubating feature. 
:app:preBuild UP-TO-DATE 
:app:preDebugBuild UP-TO-DATE 
:app:checkDebugManifest 
:app:preReleaseBuild UP-TO-DATE 
:app:prepareComAndroidDatabindingAdapters10Rc3Library UP-TO-DATE 
:app:prepareComAndroidDatabindingLibrary10Rc3Library UP-TO-DATE 
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE 
:app:prepareComAndroidSupportCardviewV72310Library UP-TO-DATE 
:app:prepareComAndroidSupportDesign2310Library UP-TO-DATE 
:app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE 
:app:preDebugAndroidTestBuild UP-TO-DATE 
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE 
:app:prepareComAndroidSupportPercent2310Library UP-TO-DATE 
:app:prepareComAndroidSupportRecyclerviewV72310Library UP-TO-DATE 
:app:prepareComAndroidSupportSupportV42310Library UP-TO-DATE 
:app:prepareComCrashlyticsSdkAndroidAnswers132Library UP-TO-DATE 
:app:prepareComCrashlyticsSdkAndroidBeta113Library UP-TO-DATE 
:app:prepareComCrashlyticsSdkAndroidCrashlytics252Library UP-TO-DATE 
:app:prepareComCrashlyticsSdkAndroidCrashlyticsCore235Library UP-TO-DATE 
:app:prepareComFacebookAndroidFacebookAndroidSdk410Library UP-TO-DATE 
:app:prepareComFacebookFrescoDrawee061Library UP-TO-DATE 
:app:prepareComFacebookFrescoFbcore061Library UP-TO-DATE 
:app:prepareComFacebookFrescoFresco061Library UP-TO-DATE 
:app:prepareComFacebookFrescoImagepipeline061Library UP-TO-DATE 
:app:prepareComGithubRahatarmanahmedCircularprogressview232Library UP-TO-DATE 
:app:prepareComGoogleAndroidExoplayerExoplayerR142Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServices810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesAppstate810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBase810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesCast810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesDrive810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesFitness810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesGames810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesGcm810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesIdentity810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesLocation810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesMaps810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesNearby810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesPanorama810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesPlus810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesVision810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesWallet810Library UP-TO-DATE 
:app:prepareComGoogleAndroidGmsPlayServicesWearable810Library UP-TO-DATE 
:app:prepareIoFabricSdkAndroidFabric136Library UP-TO-DATE 
:app:prepareDebugDependencies 
:app:compileDebugAidl UP-TO-DATE 
:app:compileDebugRenderscript UP-TO-DATE 
:app:generateDebugResValues UP-TO-DATE 
:app:generateDebugResources UP-TO-DATE 
:app:mergeDebugResources 
AAPT err(Facade for 961886319): libpng error: Not a PNG file 

FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:mergeDebugResources'. 
> Some file crunching failed, see logs for details 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Total time: 4.398 secs 

Unten ist mein build.gradle (Modul: app)

buildscript { 
    repositories { 
     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath 'io.fabric.tools:gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "us.revibe.revibe" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
     multiDexEnabled = true 
    } 
    buildTypes { 
     debug{ 
      debuggable true 
     } 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
    dataBinding { 
     enabled = true 
    } 
    dexOptions { 
     javaMaxHeapSize "4g" 
    } 
} 

repositories { 
// maven { url 'http://maven.livotovlabs.pro/content/groups/public' } 
    maven { url 'https://maven.fabric.io/public' } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:23.1.0' 
    compile 'com.android.support:cardview-v7:23.1.0' 
    compile 'com.android.support:recyclerview-v7:23.1.0' 
    compile 'com.android.support:percent:23.1.0' 
    compile 'com.android.support:design:23.1.0' 
    compile files('libs/core-3.2.1.jar') 
    compile files('libs/retrofit-1.9.0.jar') 
    compile files('libs/connectionclass-1.0.1.jar') 
    compile 'com.squareup.okhttp:okhttp-urlconnection:2.0.0' 
    compile 'com.squareup.okhttp:okhttp:2.3.0' 
    compile 'com.joanzapata.android:android-iconify:1.0.8' 
    compile 'com.github.rahatarmanahmed:circularprogressview:2.3.2' 
    compile 'com.facebook.android:facebook-android-sdk:4.1.0' 
    compile 'com.facebook.fresco:fresco:0.6.1+' 
    compile 'com.google.android.gms:play-services:8.1.0' 
    compile 'com.android.support:multidex:1.0.1' 
    compile 'com.amazonaws:aws-android-sdk-core:2.+' 
    compile 'com.amazonaws:aws-android-sdk-cognito:2.+' 
    compile 'com.amazonaws:aws-android-sdk-s3:2.+' 
// compile ('eu.livotov.labs:zxscanlib:[email protected]') {transitive=true} 

    compile 'com.google.android.exoplayer:exoplayer:r1.4.2' 
    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { 
     transitive = true; 
    } 
} 

Und unten ist mein Top-Level-build.gradle

buildscript { 
    repositories { 
     jcenter() 
     mavenCentral() 
    } 
    dependencies { 
     classpath "com.android.tools.build:gradle:1.5.0" 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

Zurückkehren Zurück zu Classpath "com.android.tools.build:gradle:1.3.1" scheint das Problem zu beheben, aber ich möchte beginnen, alle neuen Funktionen zu verwenden

+0

versuchen Sie diese http: // stackoverflow.com/a/32883231/5202007 – Tauqir

+0

oder diese http://stackoverflow.com/questions/4280398/9-patch-image-error-in-android – Tauqir

+0

Ich nahm den kurzen Weg und löschte einfach alle nicht verwendeten Dateien, die ich in meinem hatte Zeichnungsordner. Dies scheint das Problem gelöst zu haben. In der Zukunft werde ich sicherstellen, dass alle PNGs zerquetscht werden, bevor sie in den Drawables-Ordner gelegt werden. –

Antwort

0

Ich nahm den kurzen Weg und löschte einfach alle nicht verwendeten Dateien, die ich in meinem Drawables-Ordner hatte. Dies scheint das Problem gelöst zu haben. In der Zukunft werde ich sicherstellen, dass alle PNGs zerstört werden, bevor sie in den Drawables-Ordner gelegt werden, wie Tauqir vorgeschlagen hat.

20

Das Problem liegt in Ihren PNG-Dateien. Wahrscheinlich wurden Ihre Bilder durch einige Optimierungswerkzeuge optimiert. Android Studio Verwendung AAPT Werkzeug, um Bilder während des Baus Ihres Projekts zu optimieren. Der Grund für dieses Problem ist, dass AAPT Werkzeug nicht weiß, dass Sie das Bild vorverarbeitet haben.

Um dies in Ihrer Anwendung müssen Sie die Option in gradle

aaptOptions{ 
    cruncherEnabled = false 
} 

Dies ist disable AAPT Optimierung für alle Ihre png-Dateien angeben.

ähnliche Frage wurde here fragt

0

eigentlich der Grund dafür ist, Ihnen einige der so genannten .png Dateien sind nicht wirklich PNG s aber eine andere Art (meistens ich vermute, sie sind JPEG s, aber jemand anderes oder können Sie diese mit der .png Dateierweiterung werden müssen, nur von Eclipse zu täuschen umbenannt Aber denken Sie daran Android Studio ist klug, als daß . D)

um für eine Überprüfung sicher sein, ope n eine der PNG-Bilddateien, die diesen Fehler in Photoshop geben könnte wie das Werkzeug (Photoshop ist besser, denn wenn die Dateiendung anders ist als das tatsächliche Format, dann wird es auch einen Fehler geben. Wenn ja, um herauszufinden, was das tatsächliche Format Ihrer Bilddatei ist, verwenden Sie eine webapp like this).

Lösung:
Nachdem Sie Ihre Datei in Photoshop öffnen, wird es als PNG speichern. Und versuchen Sie, dies zu bauen, und meistens ist dieses Thema vielleicht weg.

Ich hoffe, diese Antwort war hilfreich für jemanden da draußen.
Prost!