add the library to your application project:
- in the project explorer, right-click your project and select properties.
- in the category panel on the left side of the dialog, select android.
- in the library pane, click the add button.
- select the library project and click ok. for example, the appcompat project should be listed as android-support-v7-appcompat.
- in the properties window, click ok.
if you open java build path dialog for the
android-support-v7-appcompat project it should look like the one on the picture below.
i know this is a bit old but if anyone had the same issue i fixed like this: from gradle leave just the last v7 (mine is compile 'com.android.support:appcompat-v7:23.1.1' and i deleted compile 'com.android.support:appcompat-v7:22.2.0' ) after that go in your class and delete the import v7...after sync again and you will see that android studio will ask automatically you if you want import the new dialog. i hope this simple case will help someone.
after more research, i've concluded that this is a symptom of android issue 16472, in which things fail if you have a project on one drive and a library on another drive. the new mechanism, in which the adt plugin creates
appcompat_v7 automatically when you set up a new project, exacerbates the problem. if the workspace is on the c: drive but you want the project files to be on some other drive, by unchecking "create project in workspace", the plugin will put the project files on your other drive but create
appcompat_v7 on the c: drive, which automatically causes the problems reported for #16472.
it's probably best to set up the workspace on the same drive where you put the project files (but i haven't tested this; and in any case, having them on different drives hasn't caused a problem for me, for non-android java projects). however, i've found a way to work around this, by copying
appcompat_v7 to the other drive:
- use the android application project wizard to create a new application, and let it create your project and a new
appcompat_v7project on different drives.
- using windows explorer or some other method, copy the newly created
appcompat_v7from c: to someplace on the other drive.
- in eclipse, delete the
- import -> android -> existing android code into workspace. browse to the location where you've made a copy of
appcompat_v7, select it, and do the import. i found that it called the new project
android-support-v7-appcompat, but this is ok. i waited for "building workspace" to complete (if you're set up not to build projects automatically, you may have to use build project on the new project).
- right-click on your application project, "properties", "android". the "library" section will probably have a path name (the path of
appcompat_v7on the c: drive) with a red x by it. click on add; a window with
android-support-v7-appcompatshould show up; click on that. it should be added to the library list with a green check mark. now select the path name on the c: drive, and click remove and then ok. i'd double-check by clicking on "properties" again, to make sure the library shows up and still has a green check mark.
after you do this, if your workspace is set up to build automatically, this should build your application successfully. (otherwise build it manually.)
if you later add another application to the same workspace, you don't need to repeat steps 2, 3, or 4. after the wizard creates your project and another new
appcompat_v7_2 or something, use step 5 to add the
android-support-v7-appcompat you've already imported and remove the old library reference, then delete the duplicate
appcompat_v7 that it just created. (see also remove v7 appcompat folder.)
- Can't get application to find android.support.v7, won't find appcompat_v7 project
- Cant get message view to show up in Android Eclipse Application
- Cant get Import my existing android project in Eclipse
- Activity wont start in Android application project
- How to remove native support from an Android Project in eclipse because eclipse is showing errors in jni?
- "could not find the yyy.apk" message in console while starting application with an android lib linked
- Adding Support Libraries to Android project
- How to get the graphical layout Window back in Eclipse for Android Application Design?
- eclipse, new android application project, "next button" is disabled in section that wants the project name
- How to create n project with ADT r20 without including the android support library?
- Including other Eclipse Projects in an Android application project
- IntelliJ Idea fails to create a new Android application project
- Inside Eclipse Android project run Java classes with main(String args) as Java Application causes "Invalid layout of java.lang.String at value"
- Not able to create Android application project in Eclipse. Error Message - Enter an application name (shown in launcher)
- New Android Application Project Can't Create Blank Activity
- Eclipse wont recognize Android support library revision 9
- Google Drive Icon file. Cant compile Eclipse Android Project
- Eclipse Kepler crashes when creating new Android Application Project
- Why do I get Link of class failed importing a jar into an Android project in Eclipse?
- referencing (pure java) project in Android project (Could not find class)
- Find total number of APIs used in an android application source code?
- What is the minimum number of steps to get full javadoc support with the new default project options?
- Android Development Eclipse - Cant Create a New Android Project - Mac OS
- Invoke "Maven Project Builder" in Eclipse on Run As -> Android Application (or manually)
- Difference between Android application project and Android Project
- Android Application Project not showing under dropdown
- How to create a new android project without using support libraries?
- Eclipse cannot find Android Support Library
- How can I get Eclipse to recognize an encryption algorithm in an Android project
- Android test project cannot find app classes
More Query from same tag
- Why will Java convert the double to float type in this situation?
- ClassNotFoundException: com.itextpdf.text.Element
- Eclipse UML plugin with Java Code Generation
- Most simple javadoc documentation for a derived exception regarding checkstyle SUN convention?
- java.lang.IllegalArgumentException: plexus.container.default: Invalid module name: 'default' is not a Java identifier
- statEt troubleshooting
- Eclipse luna Unable to read repository at http://download.eclipse.org/releases/luna/content.xml
- How can I collect some hardware profile data during the execution of the Java program with eclipse and JVM monitor?
- Instructions in the wrong order in a very simple program
- @Before is not instancing my object for @Test then
- Galaxy S2 not showing in Eclipse Mac
- i want to check that only if My first test with priority 1 is failed then My test case with priority 3 should run
- AdMob Force Close ( Android )
- How to open a Gradle wrapped project in eclipse
- wicket Exception starting filter wicket
- Java's BigInteger toString method not returning a (non-empty) String for large integers
- How to "hot" deploy war dependency in Jboss using Jboss Tools Eclipse plugin?
- Hibernate Tools - Eclipse Luna Reverse Engineer Error - NoClassDefFoundError: org.hibernate.cfg.reveng.OverrideRepository
- Eclipse: The selection did not contain any resource that can run on a server
- Unable to load configuration file in Java
- (Eclipse) An internal error occurred during: "Decoration Calculation". java.lang.StackOverflowError in Ubuntu 14.10
- Play Framework display output in console Eclipse
- Unable to create a ToggleButton in Eclipse IDE for android
- Shutdown hook doesn't work in Eclipse
- How to get Find Next to work on non-standard extensions in Eclipse?
- Can't use Tomcat server in Eclipse
- eclipse line break figure
- eclipse: debugging without binaries
- Exception in thread "main" java.lang.NoClassDefFoundError in Eclipse Gradle project
- Remote Debugging with JPDA won't connect to Tomcat through eclipse when using Docker-Compose