I'm migrating a large, complicated android library project to gradle, and am having trouble incorporating library projects into the large project. This has been discussed in other questions, but no one has yet (to my knowledge) posted about this problem. I have several applications, a bunch of third party libraries, and my own shared library. The folder structure is as follows:
--Root
-build.gradle
-settings.gradle
|--apps
|--MyApp
|--libraries
|--thirdparty
|--actionbarsherlock
-build.gradle
|--facebook
-build.gradle
|--google-play-services-lib
-build.gradle
|--personal
|--commons
-build.gradle
- AndroidManifest.xml
|--src
|--main, blah blah
|--proprietary
Now, the personal/commons library depends on all of the third party libs (ABS, Facebook, etc). Each third party lib depends only on common jar files that can be brought in from mavenCentral, and each of those builds perfectly. It's important to have the separation of thirdparty from personal libraries, and equally important that neither that nor the "libraries" folder is actually an android project in its own right.
(Update: removed everything but the base build.gradle and settings.gradle files to simplify.)
Note that I'm trying to follow a similar solution in a slightly simpler problem.
In my /root/ folder, the settings.gradle file reads:
include ':libraries:personal:commons'
include ':libraries:thirdparty:actionbarsherlock'
include ':libraries:thirdparty:facebook'
include ':libraries:thirdparty:google-play-services-lib'
include ':apps:MyApp'
and the build.gradle file at that same level (/root/) is simply empty.
Edit: removed calls to evaluationDependsOn(':thirdparty:facebook')
and the other sub-projects. Compiling yields the same answer dependency failure issue.
When I run gradle build
at the /root/libraries/personal level (again, following the linked example), it first successfully compiles all of the thirdparty libraries (hooray!). Then, it gives what looks like an actual java compile error:
/Root/libraries/personal/commons/src/main/java/com/personal/commons/dialog/AlertDialogFragment.java:19: cannot find symbol
symbol : method dismissAllowingStateLoss()
location: class com.personal.commons.dialog.AlertDialogFragment
instance.dismissAllowingStateLoss();
I suspect this is a linking problem, though, since (1) it's been compiling for over a year in Eclipse with no change in code, and (2) AlertDialogFragment extends SherlockDialogFragment, which itself extends DialogFragment, which is where dismissAllowingStateLoss()
is defined. It doesn't complain, though, about the class definition
public class AlertDialogFragment extends SherlockDialogFragment {
or the import com.actionbarsherlock.app.SherlockDialogFragment
at the top of the file, so somehow it thinks all is well, but can't resolve the dependencies. When I look at the build folder of /root/libraries/thirdparty/actionbarsherlock, a class file is indeed output for SherlockDialogFragment. Why won't my poor custom library see this?
All attempts to settle this issue thus far have failed, as my gradle-fu is still weak. Does anyone know where my fatal error is?