Search code examples
antcmdnine-patchaapt

"Error: No resource found that matches the given name..." aapt on cmd line


I have the problem that when I try to create the .apk file with the cmd line and the aapt order, It gives me the following error:

"...\res\layout-land\activity_statistics.xml:2: error: Error: No resource found that matches the given name (at 'background' with value '@drawable/bg_session')."

This error goes further thrue all layout and drawable folders. My cmd order is the following one:

"...\Android\sdk\platform-tools\aapt.exe" 
package -v -f 
-A "...\workspace\WBRLight\assets" 
-M "...\workspace\WBRLight\AndroidManifest.xml" 
-S "...\workspace\WBRLight\res" 
-I "...\Android\sdk\platforms\android-17\android.jar" 
-F "...\workspace\WBRLight\bin\WBRLight.unsigned.apk" "...\workspace\WBRLight\bin"

I checked my files if they are corrupted and clean my project folder already. With eclipse its working, but I want to to it with the cmd line order.

Could anybody help me please ? I try to solve it now since three days...


Solution

  • So i figured it out: I have to "crunch" all picture in the res folder first:

    aapt crunch -v -S \res -C \bin\res
    

    And then I pointed as a source folder to the res dir and to the bin\res dir. Also added --no-chrunch --generate-dependencies

    aapt package --no-crunch --generate-dependencies -v -f 
    -M \AndroidManifest.xml" 
    -S \bin\res
    -S \res 
    -A \assets 
    -I \android.jar 
    -F \bin\APPNAME.unsigned.apk \bin 
    

    Now Its working perfectly. Also with the .9.png 9patch pictures.