سؤال

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...

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

I found that while using multiple native extensions, there could be a filename conflict. Etc. two different extensions use the same file (and same path)

    res/values/strings.xml 

inside the ANE and during APK packaging when these resources are merged in temp folder, this file will be overwritten leading to similar error message.

Solution I've found so far is to enter the ANE archive and rename the conflicting file. You can also contact author of the extension to update it or rebuild it by yourself if possible.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top