How to fix com.android.builder.internal.aapt.AaptException: Failed to crunch file?

后端 未结 7 1617
青春惊慌失措
青春惊慌失措 2021-02-01 16:09

I have the latest version of Android Studio (as of Sep 21, 2016). When I create a brand new project in Android Studio and try to build it, I am getting this build error:

相关标签:
7条回答
  • 2021-02-01 16:29

    The solution that help me was to delete node_modules folder, remove android platform by running the command ionic platform remove android and then go upper the project folder in system hirarchy and then:

    npm install
    ionic platform add android
    ionic run android
    
    0 讨论(0)
  • 2021-02-01 16:30

    Amazing. It's 2016 and Google's tool chain still has these annoying file path limitations.

    Error: File path too long on windows, keep below 240 characters

    Move project further up your project file path and the problem goes away!

    0 讨论(0)
  • 2021-02-01 16:34

    I encountered a similar error. Just try to reduce the path length by moving the project folder up. This will surely solve the problem.

    0 讨论(0)
  • 2021-02-01 16:37

    There is a workaround. If you add the following to the project build.gradle file, inside the allprojects section, it will move the Build output files to this folder. Meaning the app will now build.:

    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    

    It does give you an additional app module at the root of the project but this is a much more convenient option than moving whole Project folder path.

    0 讨论(0)
  • 2021-02-01 16:41

    Update you gradle to latest one, it solve the problem, i was also facing same problem, it work for me.

    I was using classpath 'com.android.tools.build:gradle:2.0.0', then replace to classpath 'com.android.tools.build:gradle:3.0.0' , it work for me.

    0 讨论(0)
  • 2021-02-01 16:42

    I Found the same Error (Error: com.android.builder.internal.aapt.AaptException: Failed to crunch). I Copied the directory one level above. It Works!

    0 讨论(0)
提交回复
热议问题