这是gradle控制台:
Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
NDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to C:\Users\JUNZHISHAN Zhu\AppData\Local\Android\Sdk\ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Incremental java compilation is an incubating feature.
:app:buildInfoDebugLoader
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:prepareComAndroidSupportAnimatedVectorDrawable2530Library
:app:prepareComAndroidSupportAppcompatV72530Library
:app:prepareComAndroidSupportConstraintConstraintLayout102Library
:app:prepareComAndroidSupportDesign2530Library
:app:prepareComAndroidSupportRecyclerviewV72530Library
:app:prepareComAndroidSupportSupportCompat2530Library
:app:prepareComAndroidSupportSupportCoreUi2530Library
:app:prepareComAndroidSupportSupportCoreUtils2530Library
:app:prepareComAndroidSupportSupportFragment2530Library
:app:prepareComAndroidSupportSupportMediaCompat2530Library
:app:prepareComAndroidSupportSupportV42530Library
:app:prepareComAndroidSupportSupportVectorDrawable2530Library
:app:prepareComAndroidSupportTransition2530Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
AAPT err(Facade for 487819257): libpng error: Not a PNG file
Error: Some file crunching failed, see logs for details
:app:mergeDebugResources FAILED
:app:buildInfoGeneratorDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> Error: 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: 5.495 secs
这是我的build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}
}
我在Android Studio上运行文件时遇到错误。我只是在Layout和新的JAVA文件中添加一个新的XML文件,试图通过滑动手势来创建一个新的活动。然后发生了错误。昨天该文件运作良好。我是代码和Android工作室的新手。有人可以帮我解决这个问题吗?提前谢谢。
答案 0 :(得分:0)
AAPT错误(Facade for 487819257):libpng错误:不是PNG文件
错误:某些文件崩溃失败,请参阅日志以获取详细信息
PNG
图片格式不正确。
您应该在 build.gradle 部分添加此内容。
android
{
aaptOptions
{
cruncherEnabled = false
}
}
然后 Clean-Rebuild-Run
。