nativescript CLI build failed: No resource found that matches the given name 'android:Theme.Material.Light'.

Thread is closed for posting
8 posts, 0 answers
  1. Péter
    Péter avatar
    1 posts
    Member since:
    Oct 2014

    Posted 06 Mar 2015 Link to this post

    Hi,

    I created a project and tried to build it, but I got an error.
    I installed android 4.4.2 SDK (API 19), and a newer version was already installed: 5.0.1 (API 21)

    I could create, prepare, build, deploy to android with an older version of nativescript cli (0.4.x).

    I used the following commands:

    tns create hello
    cd hello
    tns platform add android
    tns prepare android
    tns build android


     [aapt] D:\hobbyprojects\nativescript\hello\platforms\android\res\values-v21\styles.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:Theme.Material.Light'.

    BUILD FAILED
    D:\libraries\androidsdk\tools\ant\build.xml:653: The following error occurred while executing this line:
    D:\libraries\androidsdk\tools\ant\build.xml:698: null returned: 1

    Total time: 1 second
    Command cmd failed with exit code 1

    Could you please help me, how can I build the application?
    Thanks,
    Peter
  2. Mihail
    Admin
    Mihail avatar
    75 posts

    Posted 09 Mar 2015 Link to this post

    Hello Péter,

    We observed similar problem when there are many Android SDK folders installed on the computer. For example, in one of the SDK folders there is 'platforms\android-19' directory and in another SDK folder there is 'platforms\android-21' directory.

    In order to check which platforms are available to the "tns" tool you can type the following command

    android list target

    before "tns build android" command.  Then examine the output and try to find an entry with id "android-21" and/or "API Level: 21". If you don't see such an entry you should modify your PATH environment variable to contain the correct SDK folder.

    Please let me know if that is the case.

    Regards,
    Mihail
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. diandian82
    diandian82 avatar
    13 posts
    Member since:
    Jul 2007

    Posted 11 Mar 2015 in reply to Mihail Link to this post

    I got the same problem. I only installed sdk19 and the path is C:\Users\george\AppData\Local\Android\android-sdk\platforms\android-19

    I still don't know how to fix this. 

    I run the android list target and get this list as screen shot.

    What else i can do to fix this? Is this only support android 21 above?
  4. Ludovic
    Ludovic avatar
    1 posts
    Member since:
    Mar 2015

    Posted 11 Mar 2015 Link to this post

    Same here !
  5. Ben
    Ben avatar
    1 posts
    Member since:
    May 2009

    Posted 11 Mar 2015 in reply to Péter Link to this post

    I had the same issue - I was able to workaround it by commenting out the style reference in values-v21\styles.xml
  6. Mihail
    Admin
    Mihail avatar
    75 posts

    Posted 11 Mar 2015 Link to this post

    Hello all,

    We found a bug in our build logic. I would suggest the following workarounds.

    Workaround 1
    Install Android SDK 21 and edit %your_project%/platforms/android/project.properties file to contain the following line:

    target=android-21

    If the file contains other target, please make sure to update it to android-21.

    Workaround 2
    Delete the following folder %your_project%/platforms/android/res/values-v21

    On some machines it may be needed to clean previous build artifacts. You can do that with the following commands:

    cd %your_project%/platforms/android/
    ant clean

    I will update this thread once we ship the bug fix.

    Regards,
    Mihail
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. João
    João avatar
    1 posts
    Member since:
    Aug 2010

    Posted 11 Mar 2015 Link to this post

    I replaced on the file "res/values/styles.xml" Theme.Material.Light to Theme.Light
    And works for me.
  8. RainerAtSpirit
    RainerAtSpirit avatar
    4 posts
    Member since:
    Jul 2009

    Posted 12 Mar 2015 Link to this post

    @João: Very nice, that did it for me.
Back to Top