Note that there are some explanatory texts on larger screens.

plurals
  1. POLinking compiled android libraries together in a complex project
    primarykey
    data
    text
    <p>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:</p> <pre><code>--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 </code></pre> <p>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.</p> <p>(Update: removed everything but the base build.gradle and settings.gradle files to simplify.)</p> <p>Note that I'm trying to follow a similar solution <a href="https://stackoverflow.com/questions/17536652/gradle-and-multi-project-structure">in a slightly simpler problem</a>. </p> <p>In my /root/ folder, the settings.gradle file reads:</p> <pre><code>include ':libraries:personal:commons' include ':libraries:thirdparty:actionbarsherlock' include ':libraries:thirdparty:facebook' include ':libraries:thirdparty:google-play-services-lib' include ':apps:MyApp' </code></pre> <p>and the build.gradle file at that same level (/root/) is simply empty.</p> <p><strong>Edit</strong>: removed calls to <code>evaluationDependsOn(':thirdparty:facebook')</code> and the other sub-projects. Compiling yields the same answer dependency failure issue.</p> <p>When I run <code>gradle build</code> 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 <em>looks</em> 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();</p> <p>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 <code>dismissAllowingStateLoss()</code> is defined. It <em>doesn't</em> complain, though, about the class definition</p> <pre><code>public class AlertDialogFragment extends SherlockDialogFragment { </code></pre> <p>or the <code>import com.actionbarsherlock.app.SherlockDialogFragment</code> 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. <em>Why won't my poor custom library see this?</em></p> <p>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?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload