0

I've added ActionBarSherlock to an existing android app that includes three of my own libraries. It was super easy to add the maven reference to the build.gradle files of the main project and the libraries that needed it, so that the main project now has:

dependencies {
    compile project(':ads')
    compile project(':core')
    compile project(':iap')
    compile files('libs/libGoogleAnalyticsServices.jar')
    compile 'com.android.support:support-v4:18.0.+'
    compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
}

I can go to the command line and do a ./gradlew assembleRelease and everything builds and runs as expected. However, when I'm inside Android Studio (0.4.2), it won't recognise the import statement, e.g.

import com.actionbarsherlock.app.SherlockActivity;

will get a nice red underline below "app". Accordingly the IDE shows errors for the unrecognised references. I've tried:

  • clicking the "Sync Project with Gradle Files" button
  • using the GUI to add the library reference (Open Module Settings, "Dependences" tab, "+")
  • restarting Android Studio
  • reading a lot of Stack Overflow articles!

Any suggestions on next steps? The ability to import via the compile / maven dependency was awesome, but being able to edit cleanly in the GUI would be nice :-).

mm2001
  • 6,427
  • 5
  • 39
  • 37
  • possible duplicate of [Android Studio 0.4.2 suddenly cannot resolve symbols](http://stackoverflow.com/questions/21100688/android-studio-0-4-2-suddenly-cannot-resolve-symbols) – Scott Barta Jan 15 '14 at 22:08

2 Answers2

0

To clear the errors, right click on the project and select Properties. Select Java Compiler and change the “Compiler compliance level” to 1.6.

user3021522
  • 61
  • 1
  • 3
  • 10
0

After upgrading to Android Studio 0.4.6, this problem disappeared. Go figure!

mm2001
  • 6,427
  • 5
  • 39
  • 37