aapt error 138 processDebugResources

前端 未结 5 1316
半阙折子戏
半阙折子戏 2020-12-20 13:25

Ran in to this frustrating error today when building/making project, this seems to be since installing Android SDK 22.6 (have tried the 22.6.1 too) using build tools 19.0.1,

相关标签:
5条回答
  • 2020-12-20 14:03

    This is a bug in AAPT, where it crashes when it sees a reference to a nonexistent resource. Unfortunately, it requires you to go through your resource files to try to spot the error, as it tends to not give you useful information.

    This is written up in https://code.google.com/p/android/issues/detail?id=61308 and if you look there you'll find examples of what other users have fixed to solve the crash.

    0 讨论(0)
  • 2020-12-20 14:06

    Today I faced the same problem, but no answer here, nor comment, helped me.

    At the end there were 2 problems, probably one caused by the other...

    1. My antivirus (Avast) detected "threat" from one SDK file... so probably my Android Studio thought there was no inclusion of AppCompat library in my "build.graddle" file and added a second one automatically. It looked like this:

      compile "com.android.support:appcompat-v7:21.0.+" 
      compile "com.android.support:appcompat-v7:21.+"
      

    So I deleted one of them and i got R class back, but "appt" error was still there.

    1. Aparently my dear Avast took some exe's from SDK folder, so I started "SDK Manager". In the manager, the "SDK Compile Tools" I was using (2.1.1 I think) was unckecked (maybe failed at checksum comarison), so I re-installed it.

    And VOILA!, It worked and now I'm happy.

    0 讨论(0)
  • 2020-12-20 14:07

    This is what I coded to get over the error:

    <?xml version="1.0" encoding="utf-8"?>
    
    <menu xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:blogreader="http://schemas.android.com/apk/res-auto "
        >
    
            <item  android:id="@+id/action_settings"
              android:title="@string/action_settings"
              android:orderInCategory="100"
              blogreader:showAsAction="never" />
    </menu>
    

    where in blogreader is the name of the application.

    Reference: Adding action buttons

    0 讨论(0)
  • 2020-12-20 14:07
    dexOptions {
        incremental false
        preDexLibraries = false
        jumboMode = false
        javaMaxHeapSize "3g"
    }
    
    0 讨论(0)
  • 2020-12-20 14:10

    I'm a little late, but if you originally included appcompat in your project and later removed it, there's probably a stale reference in your menu xml.

    Here's what menu looks like with appcompat

    <item android:id="@+id/action_settings"
        android:title="@string/action_settings"
        android:orderInCategory="100"
        app:showAsAction="never" />
    

    See the app:showAsAction="never"? That's what the issue was for me. Switching it back to android:showAsAction="never" fixed it for me.

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