000000000000000000000
000000000000000000000

Reputation: 1467

dimens.xml -> R not generating

When I add the file dimens.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="smart_eyeglass_controll_width">419</dimen>
    <dimen name="smart_eyeglass_controll_height">138</dimen>
</resources>

to my values folder, R will not be generated. What is wrong? The file is OK - the rest of the project to. Cleaning the project up in Eclipse won't work.

Upvotes: 0

Views: 52

Answers (3)

IntelliJ Amiya
IntelliJ Amiya

Reputation: 75788

Why it Showing

Because there are some compile error (or bug?) regarding to the xml file in res, so R is not genetared .

So,basically just Add unit beside your dimen value Like dp

    <?xml version="1.0" encoding="utf-8"?>
<resources>
    <dimen name="smart_eyeglass_controll_width">419dp</dimen>
    <dimen name="smart_eyeglass_controll_height">138dp</dimen>
</resources>

Then rebuild and clean your project

Upvotes: 2

Blackbelt
Blackbelt

Reputation: 157447

you have to specify an unit for your value, such dp. E.g

<resources>
    <dimen name="smart_eyeglass_controll_width">419dp</dimen>
    <dimen name="smart_eyeglass_controll_height">138dp</dimen>
</resources>

Upvotes: 1

Reza Bigdeli
Reza Bigdeli

Reputation: 1172

because you can't create dimens whiteout indicating that whether its a dip or sp or... if you want to create an integer value use:

<integer name="something">100</integer>

and if it has a unit put it..

<dimen name="width">100dip</dimen>

Upvotes: 1

Related Questions