3

I have imported an Android Studio project from Github into Android Studio, and although my build.gradle has the dependencies

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support:design:25.3.1'
}

I still get the error when trying to run:

Error:(4, -1) android-apt-compiler: error: Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light.DarkActionBar'.

I have very little experience with this build system. Could you please indicate what I could do to solve this error?

Ahmer Afzal
  • 501
  • 2
  • 11
  • 24
user2565010
  • 1,876
  • 4
  • 23
  • 37
  • I only found a couple of answers for Android studio there, which were basically to add the line shown above to build.gradle. It obviously didn't work. – user2565010 Apr 20 '17 at 04:24
  • I solved the issue eventually. Might be worth reopening the question to share my answer. – user2565010 Apr 20 '17 at 05:31

2 Answers2

1

Make sure you have installed Support repository.

In Android Studio, you can check from Tools> Android > SDK manager > SDK Tools tab. Support Repository

You may update your Android Studio, SDK tools, Build tools if updates are available.

If still no luck, from project's values folder try to edit style.xml file and change theme: Theme.AppCompat.Light.DarkActionBar to something else like: Theme.AppCompat.Light

Jakir Hossain
  • 800
  • 6
  • 12
  • I tried that everything you mentioned. At first, I already had Android Support Repository and Google Repository installed, but I installed the other two. Also, I am told `Cannot resolve symbol 'Theme' less... (⌘F1) Validates resource references inside Android XML files` so the alternate name also doesn't work. Also tried that with Rebuild and invalidate cache. – user2565010 Apr 20 '17 at 05:03
  • Can you share your full build.grade file? – Jakir Hossain Apr 20 '17 at 05:07
  • Actually, I managed to solve the issue. The problem was that the initial project was wrapped around another project. This is because I imported the project from github and selected yes at the Checkout From Version Control dialog box that appears due to that. Will answer the question as soon as it is reopened. – user2565010 Apr 20 '17 at 05:30
0

add compile 'com.android.support:support-v4:25.3.1' to your app module dependencies

Linh Nguyen
  • 1,264
  • 1
  • 10
  • 22