Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Need help I get this error "This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first."

Hi I'm I keep getting this error when I try and run the Crystal Ball app in the emulator

NOTE: This project contains resource errors, so aapt did not succeed, which can cause rendering failures. Fix resource problems first.

"0.2dp" in attribute "layout_weight" cannot be converted to float. "0.6dp" in attribute "layout_weight" cannot be converted to float.

Here is what my console says if that helps.

[2013-07-30 12:25:30 - Unexpected error while launching logcat. Try reselecting the device.] device not found com.android.ddmlib.AdbCommandRejectedException: device not found at com.android.ddmlib.AdbHelper.setDevice(AdbHelper.java:752) at com.android.ddmlib.AdbHelper.executeRemoteCommand(AdbHelper.java:373) at com.android.ddmlib.Device.executeShellCommand(Device.java:462) at com.android.ddmuilib.logcat.LogCatReceiver$1.run(LogCatReceiver.java:110) at java.lang.Thread.run(Thread.java:680)

[2013-07-31 18:55:47 - DeviceMonitor] Failed to start monitoring FA35GS907587

It won't let me run the app until I fix these errors.

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

layout_weight is looking for a regular number value. You are including dp in the value, which isn't appropriate here--you only need the number part. The layout_weight is kind of like a percentage, although you have control if you want about how much it should add up to. In this case we want everything to add up to 1, so 0.6 is like 60% of the width.

dp is short for "density-independent pixels", and we use that whenever we want to specify the width of something in terms of pixels on the screen. Instead of using exact pixels, though, since so many screens are different and pixels mean different sizes on different screens, we use dp, which Android automatically converts behind the scenes for us so that our display looks consistent on different screens.