com.android.ide.common.process.ProcessException:无法执行aapt!我能做什么?

时间:2017-09-09 18:44:13

标签: android ionic-framework build aapt

当我尝试在Android设备上运行时,我收到错误!我不知道发生了什么!

我能做些什么来解决它?

失败:构建因异常而失败。

建立失败

Total time: 7.791 secs

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:373: AAPT: Attribute "theme" already defined with incompatible format.

C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:359: AAPT: Original attribute defined here.

C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15:21-54: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.

C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:373: error: Attribute "theme" already defined with incompatible format.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values\values.xml:359: Original attribute defined here.
C:\tmp\myproj\platforms\android\build\intermediates\res\merged\debug\values-v26\values-v26.xml:15: error: Error: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.



FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

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

[ERROR] An error occurred while running cordova run android (exit code 1).

解决

解决:重新创建项目并再次添加功能!

4 个答案:

答案 0 :(得分:15)

将此代码放在build.gradle的最后一部分

@RunWith(SpringRunner.class)
@SpringBootTest
public class AppTest {

    @Test
    public void contextLoads() {
    }

}

答案 1 :(得分:4)

如果您将v4 v7版本更新为26.0.0, 你也应该改变CompileSdkVersion和BuildToolsVersion 到26.0.0

答案 2 :(得分:1)

对我来说,这个错误的奇怪原因是我错过了布局中的可绘制对象。我从另一个项目复制了布局,却忘记了在运行项目之前复制可绘制对象。 另外,请检查布局中的活动名称是否没有空格。

答案 3 :(得分:0)

此问题来自项目环境和执行平台环境不匹配。 尝试创建一个新项目并在同一平台环境中运行。 如果运行,则复制粘贴旧项目的src文件。

$ ionic start 
$ cd "project_name"
$ ionic cordova platform add android
$ ionic cordova run android
copy-paste old project src files