0

I am having problems setting up my eclipse program with Android for my first project. After installing eclipse together with the android developer tools, I tried to create a new 'Android Project' with a minimum sdk of Android 2.2, a target sdk of Android 6.0 and a sdk compiler of Android 7.1.1.

After clicking run, Eclipse displayed an error, which indicated that there was issues with my empty activity: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light' I have done my research for this problem and most of the solutions suggested importing an Android Project called "AppCompat-v7". However, upon selecting the file, there were no projects found that could be imported. This is what I see: Import project window:

enter image description here

I have spent numerous hours trying to fix this issue. I have ensured that both my eclipse program and all android files are under the same hard disk, I have tried adding the file to the build path etc. but the same problem persists. Anyone out there who can help me with this issue please? I would greatly appreciate it :) If you need more details regarding what I have done so far, feel free to contact me!

Someone commented below suggesting that I import the "AppCompat-v7" folder to the package explorer and then go to Project->Properties to add the appcompat library folder. I managed to add the folder to my package explorer but I am not able to add the library to the project, as no library options show up. This is even so after checking the "IsLibrary" box.

Jordan Tan
  • 43
  • 1
  • 8
  • there should be a folder called "appcompat_v7" in your Package Explorer, where all your Projects are. If it is there right click on your Project select "Properties" than select "Android" and click the "Add..." Button under Library. Select "appcompat_v7" and Apply it. – ORY Feb 12 '17 at 11:00
  • I tried importing the file folder into my package explorer. I now see the folder "app-compat v7" above my project in the package explorer. However, when I go to project->properties, I am not able to find the library folder under "android". Nothing shows up, even after I checked the "Is Library" option. – Jordan Tan Feb 12 '17 at 12:09
  • Can you try the Versions from here: http://stackoverflow.com/questions/27490505/where-is-the-eclipse-adt-bundle-link – ORY Feb 12 '17 at 19:08

2 Answers2

1

AppCompat-v7 should be added to your module Gradle file. It goes in the dependencies section.

For example:

dependencies {
   compile fileTree(include: ['*.jar'], dir: 'libs')
   compile 'com.android.support:appcompat-v7:25.1.1'
   testCompile 'junit:junit:4.12'
}
theblitz
  • 6,161
  • 14
  • 52
  • 107
  • Thanks for trying to answer but yes, I am using Eclipse so i don't know if the build.gradle part might be relevant – Jordan Tan Feb 12 '17 at 11:57
  • Of course, this would be a good time to move to Android Studio ....... :) – theblitz Feb 12 '17 at 12:17
  • Apologies but I am still VERY new to programming.. Would I still be able to create Android Apps and perhaps market it on the "Play Store" eventually by solely using the Android Studio Platform? – Jordan Tan Feb 12 '17 at 12:24
  • Definitely. Android Studio is now the preferred platform for Android development. It takes a little getting used to when switching from Eclipse but well worth the effort. – theblitz Feb 12 '17 at 12:28
  • Alright, thanks a bunch **theblitz**! I'll try switching over to Android Studio instead and see if that works out for me :) – Jordan Tan Feb 12 '17 at 12:35
  • he is right. android is moving on to new environment and the more you stay in eclipse, more you face new problems. been there, done that. i used to work on android in Eclipse IDE but finally had to move to android studio. – Mehran Zamani Feb 12 '17 at 12:46
  • Thank you Mehran Zamani for trying to answer my question as well. I shall switch over to Android Studio then :) – Jordan Tan Feb 12 '17 at 13:02
  • Just make sure to read up the migration guides. The actual moving over is real easy because Android Studio knows how to import from Eclipse. Nevertheless, it is a new environment. Everything will work but you will have to get used to how things are built. – theblitz Feb 12 '17 at 13:05
  • Can't agree more with all the comments that you should migrate to Android Studio. You will have a MUCH easier time of development and your final product will be MORE compatible with future Android. – Booger Feb 12 '17 at 13:07
1

if you have Appcompat v7 in your extras folder follow this link but if you don't have it:

To download the Support Library through the SDK Manager:

  1. Start the Android SDK Manager.
  2. In the SDK Manager window, scroll to the end of the Packages list, find the Extras folder and, if necessary, expand to show its contents.
  3. Select the Android Support
  4. Repository item. Click the Install packages... button.

enter image description here

After downloading, the tool installs the Support Library files to your existing Android SDK directory. The library files are located in the following subdirectory of your SDK: <sdk>/extras/android/m2repository/com/android/support/ directory.

Update: Import it like this picture

enter image description here

you are now have your library in your project Explorer like this

enter image description here

the rest is adding library project

Community
  • 1
  • 1
Mehran Zamani
  • 817
  • 9
  • 29
  • I have downloaded and installed the "Android Support Repository" folder in my Android SDK manager previously already. Upon opening the location on my hard drive, I can see that AppCompat-v7 folder exists and contains more folders labelled 18 to 25.1.1. My computer still does not seem to detect any existing android projects in that "AppCompat-v7" folder however. – Jordan Tan Feb 12 '17 at 12:20
  • search your hard drive to find the `appcompat-v7` folder – Mehran Zamani Feb 12 '17 at 12:22
  • I am able find the AppCompat-v7 folder under support, yes. What I meant was upon going to Eclipse and clicking on **"Import->Existing Android Code into Workspace"**, and then selecting that very "AppCompat-v7" folder, no files appear under the "Project to Import" section. – Jordan Tan Feb 12 '17 at 12:33
  • Yes, I see the project now :) After selecting the AppCompat-v7 project, do I check any of the "Options" below, such as "Search for nested projects"? After adding the project to my package explorer, what do I do next? – Jordan Tan Feb 12 '17 at 12:56
  • I still do not see any files under "Library" for **Project->Properties->Android**. The same goes after checking "Is Library" option. – Jordan Tan Feb 12 '17 at 12:59