Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6914653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:22:30+00:00 2026-05-27T09:22:30+00:00

For some reason my Android project compiles properly, runs fine on both phones and

  • 0

For some reason my Android project compiles properly, runs fine on both phones and emulators, and even includes multiple XML layout files with LinearLayouts, TextViews, Buttons, Images, and even custom View components, but when it comes to shapes it simply can’t find them.

Heres my code:

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <solid android:color="#ffffff"/>    

    <stroke android:width="3dp"
            android:color="#ff000000"/>

    <padding android:left="1dp"
             android:top="1dp"
             android:right="1dp"
             android:bottom="1dp"/> 

    <corners android:radius="30dp"/> 
</shape>

And the error I get in the graphical layout in eclipse:

com.android.layoutlib.bridge.MockView cannot be cast to android.view.ViewGroup
Exception details are logged in Window > Show View > Error Log
The following classes could not be found:
- shape (Fix Build Path, Edit XML)
- solid (Fix Build Path, Edit XML)

I’m targeting Android 2.2 Froyo Google APIs.

Suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:22:31+00:00Added an answer on May 27, 2026 at 9:22 am

    You’re probably getting the error because you’re putting this XML in the wrong place. The XML above should go in the res/drawable directory. You really should not draw a square in the Layout. Draw a Square in a View and add it to the Layout. Or use an image and add it to a View via an ImageView. A Layout is an aggregation of Views. If you really want to draw a Square in a Layout (ViewGroup) you can extend one and draw it in the onDraw() method. But that’ll probably be more complicated than needed. Have a look at the the Android Docs on Layouts: http://developer.android.com/guide/topics/ui/index.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason my android ContentObserver is being registered multiple times. The ContentObserver is
I just had the odd case that my Android project for some reason would
For some reason, after I build my Android project in Eclipse, it is not
We have a bigger Android 2.1 project, and for some reason, only at two
I am using IntelliJ for my Android development and for some reason it is
I have created some aidl files for IPC in my Android project. They compile
In my android app I read GPS data and GPS time. For some reason
For some reason my eclipse/android development environment has stopped creating the r.java files and
For some reason, and only on my Dell Vostro 1000 laptop, the Android emulator
I'm using Android 2.2, which comes with a version of STLport. For some reason,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.