4

Whenever I create new project it always creating appcompat_v7 project with my new project. And when I create new android activity it always extend ActionBarActivity and also create fragment_main.xml. I tried to update adt and s\w also still no luck

and this code also generated in main activity

 public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container,
                false);
        return rootView;
    }
} 
Cœur
  • 37,241
  • 25
  • 195
  • 267
user3244282
  • 91
  • 2
  • 10
  • It gets created based on the options you selected when you created a new Android project in Eclipse. The **appcompat_v7** is required if you use any components from the `ActionBar` support library. – ChuongPham Mar 07 '14 at 12:58
  • your min sdk could be below 11. Make sure when you create the min sdk is above 11 – Raghunandan Mar 07 '14 at 12:59
  • same things are selected perv that time it was not coming , even i select no theme still it coming – user3244282 Mar 07 '14 at 12:59
  • but y fragment layout is creating – user3244282 Mar 07 '14 at 13:00
  • i want to use actionbarsherlock thats y i have kept it min8 , is this new features that it automatically cr8 appcompat_v7 and fragment.xml coz perv it was not there – user3244282 Mar 07 '14 at 13:04
  • @user3244282 its not a different behaviour. Its normal. You will be using fragments in most cases. – Raghunandan Mar 07 '14 at 13:05
  • na i am not using fragments , i have just cr8d new project – user3244282 Mar 07 '14 at 13:06
  • @user3244282 delete the fragment and move on – Raghunandan Mar 07 '14 at 13:07
  • ok , what about ActionBarActivity ? if i remove appcompatv7 and use actionbarsherlock then r.java is not coming – user3244282 Mar 07 '14 at 13:09
  • I think this is **not the normal behavior**. I too worked with miinSdk = 8 but I didnt get `ActionBarActivity`.... Now why is it coming? Any explanations?? @Raghunandan – SweetWisher ツ Mar 12 '14 at 06:22
  • @SweetWisherツ not sure gotta check if there is bug filed. Also if you use Android Studio i guess it will have the fragment generated – Raghunandan Mar 12 '14 at 06:26
  • Please check it and explain the reason of this change if you come to know.. :) – SweetWisher ツ Mar 12 '14 at 06:28
  • Can you come [here??](http://chat.stackoverflow.com/rooms/34595/creative-developers) and solve our doubts?? @Raghunandan – SweetWisher ツ Mar 12 '14 at 06:31
  • I also noticed this and I do not understand why it would create a separate project for appcompat_v7. If you look under "Android Private Libraries" in your actual project, you will see that the support library is there (android-support-v7-appcompat.jar) so I don't really know why a separate project is needed... – Simon Apr 01 '14 at 18:40
  • Question : same problem in my case , Can you please explain why this is happening . – Tushar Pandey Apr 18 '14 at 07:13

1 Answers1

0

I had the same problem. I have figured out 3 ways hope this helps

  1. (this may or may not work) Check your android virtual device manager. I would think you have a device that has CPU/ABI selected for "armeabi-v7a". Delete that device and try creating a new project. You would notice that project appcompat_v7 is no longer being created.
  2. (Works) Another way to avoid this would to create new project through android project through existing codes. Hopeful you have a project you created from before to copy over.
  3. (Works) Create a blank android project without activity and create the activity later.
Maerlyn
  • 33,687
  • 18
  • 94
  • 85
  • with latest version of ADT (released 7-2-2014) looks like they have fixed this problem. For older android version support (2.2) they would allow you to either create with activity or activity with fragment for app compatibility. not default it to fragment activity. – user3773999 Jul 18 '14 at 12:46