libpng erreur: Pas un fichier PNG
J'ai essayé plusieurs fois de mettre à niveau Android Studio construire des outils passé 1.3.1, mais je finis toujours avec cette libpng erreur. J'ai résolu l'une des erreurs en supprimant complètement une dépendance maven (depuis le gradle console pointu exactement où le problème de fichier), mais maintenant je suis coincé avec le même message d'erreur et pas de pointeur à l'endroit où le problème du fichier est. Ai-je raté quelque chose? Voici la gradle journal de la console:
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
Ci-dessous est mon build.gradle (Module: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:2.0.1@aar') {transitive=true}
compile 'com.google.android.exoplayer:exoplayer:r1.4.2'
compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') {
transitive = true;
}
}
Et c'est en dessous de mon niveau supérieur de construire.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()
}
}
De retour à classpath "com.android.outils.construire:gradle:1.3.1" semble résoudre le problème, mais je voudrais commencer à utiliser toutes les nouvelles fonctionnalités
ou cette stackoverflow.com/questions/4280398/...
J'ai pris le chemin court et simplement supprimé tout les fichiers inutilisés, j'ai eu mon un drawable dossier. Cela semble avoir résolu le problème. Dans l'avenir, je ferai en sorte de l'écraser de toute la PNG avant de les placer dans l'un drawable dossier
exécutez la commande suivante pour supprimer toutes les métadonnées de tous les fichiers png. Exécuter la commande dans votre dossier res: (sauvegarde!) trouver . -iname '*png' -exec pngcrush -ow-rem allb -brute -réduire {} \;
pouvez-vous accepter la réponse?
OriginalL'auteur Matei Canavra | 2015-11-21
Vous devez vous connecter pour publier un commentaire.
Le problème est dans vos fichiers png. Probablement vous images ont été optimisés par certains png outils d'optimisation. Android studio AAPT outil pour optimiser les images lors de la construction de votre projet. La raison de ce problème est que AAPT outil ne sais pas ce que vous prétraité à l'image.
Pour contourner ce problème dans votre application, vous devez spécifier l'option dans gradle
C'est de désactiver AAPT d'optimisation pour l'ensemble de vos fichiers png.
Question semblable a été posée ici
OriginalL'auteur Volodymyr Khodonovych
J'ai pris le chemin court et simplement supprimé tout les fichiers inutilisés, j'ai eu mon un drawable dossier. Cela semble avoir résolu le problème. Dans l'avenir, je ferai en sorte de l'écraser de toute la PNG avant de les placer dans l'un drawable dossier, comme Tauqir suggéré.
OriginalL'auteur Matei Canavra
En fait, la raison pour cela est votre certains des soi-disant
.png
fichiers ne sont pas réellement PNGs mais d'un autre type (pour la plupart je soupçonne qu'ils sont JPEGs, mais quelqu'un d'autre ou peut-être vous avez renommé avec le.png
l'extension de fichier juste pour tromper l'Éclipse. Mais rappelez-vous Android Studio est intelligent que 😀 )Pour être sûr de vérifier, ouvrez l'un des fichiers d'image PNG qui pourrait être de donner cette erreur dans Photoshop comme outil (Photoshop est mieux, parce que si l'extension du fichier est bien différent du format réel ensuite il donnera également une erreur. Si donc, pour savoir quel est votre fichier d'image de format réel est d'utiliser un webapp comme ceci).
Solution:
Après l'ouverture de votre fichier dans Photoshop, l'enregistrer en PNG. Et essayez de construire le présent et la plupart du temps, ce problème peut avoir disparu.
Espère que cette réponse vous a été utile à quelqu'un.
Cheers!
OriginalL'auteur Randika Vishman