2014-09-12 8 views
1

Можно ли создавать структуры подпапок внутри основных разделов res, особенно в папке с возможностью рисования с помощью Gradle?Возможно создание вложенных папок в выпадающей папке в Android Studio?

Я попытался это до сих пор

sourceSets { 

    main { 
     res.srcDirs = [ 
       "/src/main/res/drawable-xhdpi/actionbar_items", 
       "/src/main/res/drawable-xhdpi/intro", 
       "/src/main/res/drawable-xhdpi/loading_screen", 
       "/src/main/res/drawable-xhdpi", 
       "/src/main/res", 
     ] 
    } 
} 

Когда я восстановить проект, однако я получаю это Gradle строить сообщения об ошибке что-то вроде этого:

Error:(39, 23) No resource found that matches the given name (at 'icon' with value  '@drawable/app_icon'). 
Error:(40, 24) No resource found that matches the given name (at 'label' with value '@string/app_name'). 
Error:(42, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme'). 
Error:(45, 28) No resource found that matches the given name (at 'label' with value '@string/app_name'). 
Error:(50, 28) No resource found that matches the given name (at 'label' with value '@string/app_name'). 
Error:(55, 28) No resource found that matches the given name (at 'label' with value '@string/app_name'). 
Error:(73, 28) No resource found that matches the given name (at 'label' with value '@string/app_name'). 

Error:Execution failed for task ':app:processDebugResources'. 

com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/adrian/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/aapt package -f --no-crunch -I /Users/adrian/adt-bundle-mac-x86_64-20140702/sdk/platforms/android-19/android.jar -M /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml -S /Users/adrian/Development/alstom_framework/app/build/intermediates/res/debug -A /Users/adrian/Development/alstom_framework/app/build/intermediates/assets/debug -m -J /Users/adrian/Development/alstom_framework/app/build/generated/source/r/debug -F /Users/adrian/Development/alstom_framework/app/build/intermediates/libs/app-debug.ap_ --debug-mode --custom-package com.hiddenltd.framework -0 apk --output-text-symbols /Users/adrian/Development/alstom_framework/app/build/intermediates/symbols/debug Error Code: 1 Output: /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:35: error: Error: No resource found that matches the given name (at 'icon' with value '@drawable/app_icon'). /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:35: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name'). /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:35: error: Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme'). /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:43: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name'). /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:48: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name'). /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:52: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name'). /Users/adrian/Development/alstom_framework/app/build/intermediates/manifests/debug/AndroidManifest.xml:70: error: Error: No resource found that matches the given name (at 'label' with value '@string/app_name').

Это означает, что для меня, что gradle видит только папки res, указанные мной в файле app.gradle? Поэтому я добавил остальную часть в app.gradle и возникла такая же ошибка ... Может ли кто-нибудь помочь, пожалуйста ....

+0

Я посмотрел на этот вопрос http://stackoverflow.com/questions/4930398/can-the-android-la yout-folder-содержать-вложенные папки, и я следовал за решением, предложенным во втором ответе на этот вопрос, где кто-то менеджер создает вложенные папки для макета res folder –

ответ

2

Нет, Android ожидает, что все файлы будут находиться в одном каталоге и не разрешают вложенных папок.

Большинство приложений используют именовании вместо вложенных папок, так что в вашем примере вы могли бы в конечном итоге со списком файлов:

  • intro_welcome.png
  • intro_background.png
  • loading_splashscreen.png
  • actionbar_delete.png
Смежные вопросы