Fabio Galeppi
Fabio Galeppi

Reputation: 41

R.Java don't create

R.Java don't create because I have errore in code an I accidentally deleted R.java.

Here is the code:

public SwipeyTabs(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        final TypedArray a = context.obtainStyledAttributes(attrs,
                R.styleable.SwipeyTabs, defStyle, 0);

        mBottomBarColor = a.getColor(R.styleable.SwipeyTabs_bottomBarColor,
                mBottomBarColor);
        mBottomBarHeight = a.getDimensionPixelSize(
                R.styleable.SwipeyTabs_bottomBarHeight, 2);
        mTabIndicatorHeight = a.getDimensionPixelSize(
                R.styleable.SwipeyTabs_tabIndicatorHeight, 3);

        a.recycle();

        init();



    }

And in xml

 <com.example.uniradio.SwipeyTabs
    android:id="@+id/swipeytabs"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#ff3b3b3b"
    swipeytabs:bottomBarColor="#ff96aa39"
    swipeytabs:bottomBarHeight="2dip"
    swipeytabs:tabIndicatorHeight="3dip" />

Now, how do I create it?

Upvotes: 1

Views: 910

Answers (4)

Kumar Vivek Mitra
Kumar Vivek Mitra

Reputation: 33534

Try these tips.....

1 First Clean the project, from your Eclipse IDE

2 Please see that there are no errors in any of the .java files and specially in the .xml files.

3 Please remove all the Errors from the Error logs; I know this is weird but that's how Eclipse works.

4 R.java file is automatically generated and contains the public static final constants grouped according to their XML resource type.

5 After you are sure about the 1st , 2nd and 3rd point above, try deleting the R.java file, clean the project, after this shutdown your Eclipse. And again open it.

Upvotes: 0

Nguyen
Nguyen

Reputation: 151

I had problem like you. Lest try: Open Android SDK Manager -> reinstall packages Android SDK Platform-Tools and Android SDK Build-Tools in Tools folder.

Upvotes: 0

Marcos Placona
Marcos Placona

Reputation: 21720

You can basically do it two ways:

You can either run it from eclipse as suggested here, by going to Project -> Build Project, or simply running a "clean"

build android project

Or you can try and create an APK of your app via command line, which will then generate the .R files as well as the APK.

If there are any errors, the command line will report it.

To do it via command line, you can run the following:

ant release

From within your project directory

Upvotes: 0

jeet
jeet

Reputation: 29199

R file is not being generated, due to error in xml, do as follows to find error,

eclipse menu->windows-> show view -> problems

and do corrective options.

Upvotes: 3

Related Questions