Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove v7 appcompat folder

After Updating my adt plugin. When ever I create any project "appcompat v7" folder is created . I used this dependency. But problem is suppose I have 5 projects then. it makes 5 different folders what to do?

like image 286
Prashant Patel Avatar asked Mar 20 '14 19:03

Prashant Patel


1 Answers

This is part of the ADT/SDK update and it is not a bad thing to happen. It ensures that your app has full support of the ActionBarActivity that was implemented in API 14+. It will get created each time by default, but with a little work you can keep your files down. I simply have a single appcompat_v7, whenever I create a project, let's call it SampleApplication, appcompat_v7_2 is created.

  • How to re-reference your library -

Right click on "SampleApplication"

Go to "Properties"

Click "Android"

Scroll to the bottom's "Library" section

Click "..\appcompat_v7"

Click "Remove"

Click "Add"

Click on "appcompat_v7"

Click "Apply"`

Now you have referenced your preexisting library. You now need to delete your old "extra" duplicate appcompat_v7_2 library. I do this as follows:

  • Deleting duplicated copy -

Right click on "appcompat_v7_2" in the Package Explorer of your workspace

Click "Delete"

if(Delete Options contains checkbox to delete from physical workspace){
    Check the checkbox to delete the physical folder from your hard drive and press OK;
}
else{
    Go to your physical workspace (In Windows, something like C:......\workspace);
    Find "appcompat_v7_2";
    Right click on "appcompat_v7_2" in your physical workspace;
    Click "Delete";
}
Restart Eclipse;

After referencing to your pre-existing library, you may get an error with your application that reads in the console as Found 2 versions of android-support-v4.jar in the dependency list,... To solve that problem, go into your applications libs folder in your workspace and delete the android-support-v4.jar.

It is not ideal as it requires a bit of setup for each application. But it works. You can also uncheck "Create Activity" when you are creating your application project and it won't add the library (but also, obviously, won't include your main activity).

As another note, apparently for some people it doesn't include the library if your minimum sdk version for your application is 11+. For me, however, it always includes it, so this is my way around it.

IMPORTANT FIND - PLEASE READ

So I decided to start a new workspace for a library project I am working on and came across something interesting. I imported my appcompat_v7 into my new workspace from my old workspace, making sure to click on Copy projects into workspace. Now it doesn't add appcompat_v7 every time that I add a new project into my new workspace. Led me to realizing a possible fix:

try moving appcompat_v7 from your workspace folder to another folder, and the importing it back into your workspace making sure to click Copy projects into workspace.

Not sure if it was just a glitch or something, but it worked twice when I retested it!

like image 57
zgc7009 Avatar answered Oct 23 '22 19:10

zgc7009