编译时异常描述如下:
Information:Gradle tasks [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
Error:Tag <uses-permission> attribute name has invalid character '?'.
Error:Tag <uses-permission> attribute name has invalid character '?'.
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process E:\Android\Sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I E:\Android\Sdk\platforms\android-26\android.jar -M \\?\F:\gangrong\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S F:\gangrong\app\build\intermediates\res\merged\debug -m -J \\?\F:\gangrong\app\build\generated\source\r\debug -F F:\gangrong\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.wcyq.gangrong -0 apk --output-text-symbols \\?\F:\gangrong\app\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process E:\Android\Sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I E:\Android\Sdk\platforms\android-26\android.jar -M \\?\F:\gangrong\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S F:\gangrong\app\build\intermediates\res\merged\debug -m -J \\?\F:\gangrong\app\build\generated\source\r\debug -F F:\gangrong\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.wcyq.gangrong -0 apk --output-text-symbols \\?\F:\gangrong\app\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'E:\Android\Sdk\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
解决办法:
注释掉:项目工程中的gradle.properties 里面的android.enableAapt2=false 运行即可,
之前是以为清单文件中的acitivity或者权限,之间有空格造成的,原来不是!是gradle.properties android.enableAapt2=false这个造成的!因为grade.properties里面我写了东西.
gradle.properties
# Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true android.useDeprecatedNdk=true//这个如果没有,下面这个放开是不会报错的! #android.enableAapt2=false