Search code examples
androidandroid-studior.java-file

Tons of items in R.java created by android studio


It's my first use of Android studio. But when I use it to create my first project, I found that in R.java(The location is app/build/source/r/debug/com.example.myapplication) The beginning is like this:

public final class R {
    public static final class anim {
        public static final int abc_fade_in = 0x7f040000;
        public static final int abc_fade_out = 0x7f040001;
        public static final int abc_slide_in_bottom = 0x7f040002;
        public static final int abc_slide_in_top = 0x7f040003;
        public static final int abc_slide_out_bottom = 0x7f040004;
        public static final int abc_slide_out_top = 0x7f040005;
    }
    public static final class attr {
        public static final int actionBarDivider = 0x7f01005a;
        public static final int actionBarItemBackground = 0x7f01005b;
        public static final int actionBarPopupTheme = 0x7f010054;
        public static final int actionBarSize = 0x7f010059;
        public static final int actionBarSplitStyle = 0x7f010056;
        public static final int actionBarStyle = 0x7f010055;
        public static final int actionBarTabBarStyle = 0x7f010050;
        public static final int actionBarTabStyle = 0x7f01004f;
        public static final int actionBarTabTextStyle = 0x7f010051;
        public static final int actionBarTheme = 0x7f010057;
        public static final int actionBarWidgetTheme = 0x7f010058;
        public static final int actionButtonStyle = 0x7f010072;
        public static final int actionDropDownStyle = 0x7f01006d;
        public static final int actionLayout = 0x7f01002c;
        public static final int actionMenuTextAppearance = 0x7f01005c;
        public static final int actionMenuTextColor = 0x7f01005d;
        public static final int actionModeBackground = 0x7f010060;
        public static final int actionModeCloseButtonStyle = 0x7f01005f;
        public static final int actionModeCloseDrawable = 0x7f010062;

It list so many items that if I put them to Word, they will fill 38 pages in 11 font size. I tried deleted them, rebuilt them, restart, create another project, but they still exist. I had used Eclipse so I know how it should looks like. What's the problem? Is it caused by Gradle or Android Studio itself?


Solution

  • Deleting, rebuilding, restarting are not the correct approaches you should take. These lines are generated by the Android Support Library.

    Including the Support Libraries in your Android project is considered a best practice for application developers, depending on the range of platform versions your app is targeting and the APIs that it uses. Using the features the libraries provide can help you improve the look of your application, increase performance and broaden the reach of your application to more users. If you use the Android code template tools, you will notice that all the Android application templates include one or more of the Support Libraries by default.

    [1] http://developer.android.com/tools/support-library/index.html

    Yet, I don't understand why you want to take them off.