运行应用程序时出现Android错误
在我测试一个项目之前,一切都很好。但是,当我单击“运行”按钮时,我得到一个错误: 错误:任务“:app:processDebugResources”的执行失败 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'C:\Users\Jim\AppData\Local\android\sdk\build tools\22.0.1\aapt.exe''以非零退出值1完成 在控制台中,我得到以下信息: 正在执行的任务:[:app:generateDebugSources,:app:generateDebugAndroidTestSources]运行应用程序时出现Android错误,android,android-studio,android-gradle-plugin,Android,Android Studio,Android Gradle Plugin,在我测试一个项目之前,一切都很好。但是,当我单击“运行”按钮时,我得到一个错误: 错误:任务“:app:processDebugResources”的执行失败 com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:process'command'C:\Users\Jim\AppData\Local\android\sdk\build tools\22.0.1\aapt.e
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:prepareComAndroidSupportAppcompatV72220Library
:app:prepareComAndroidSupportSupportV42220Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
BUILD SUCCESSFUL
Total time: 17.327 secs
Executing tasks: [:app:assembleDebug]
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:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library 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:generateDebugResources UP-TO-DATE
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
AGPBI: {"kind":"SIMPLE","text":"res\\drawable-mdpi-v4\\private.png:0: error: invalid symbol: \u0027private\u0027","position":{},"original":"res\\drawable- mdpi-v4\\private.png:0: error: invalid symbol: \u0027private\u0027"}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\Jim\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe'' finished with non-zero exit value 1
- 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.bob.app"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
然后,当我使用R时,我得到一个错误:无法解析符号R
但我只使用setContentView(R.layout.activity_main)
如何解决此错误?事实证明,我有一个图像无法正常工作。我删除了图像,程序开始运行
AGPBI: {"kind":"SIMPLE","text":"res\\drawable-mdpi-v4\\private.png:0: error: invalid symbol: \u0027private\u0027","position":{},"original":"res\\drawable- mdpi-v4\\private.png:0: error: invalid symbol: \u0027private\u0027"}
private.png是一个图像。它与我的gradle文件或任何代码无关。尝试将BuildTools版本更改为“21.0.1”