-
Notifications
You must be signed in to change notification settings - Fork 132
Cannot use library via gradle on large project ? #144
Comments
No idea, but I would be very surprised if this is a squidb problem. Is it possible you're hitting the dex limit? http://developer.android.com/tools/building/multidex.html. What's the error you're seeing? |
There is no error, but since the only library that's available is the annotation one, I can't use any class of the repo. |
btw, is it true there is version 3, yet the gradle version is still on 2 ? |
Version 3 is in beta, so it's only available via source at this time (via this branch). I've never seen this issue before and we too use squidb in projects with a very large number of dependencies, so I'm not sure what else to suggest. If you can post your gradle configuration or a sample project that exhibits the issue I'd be happy to take a look! |
About beta, it's ok to put beta repos on gradle. Google does this all the time (including alpha). |
I suppose I should have clarified -- we've chosen not to put v3 on jcenter yet not because of a technical limitation but because we don't feel it's entirely ready for public consumption :) For those that are eager to test it (the main new feature is j2objc support) building from source is pretty easy. It'll be ready soon! Gives me an idea though -- have you tried cloning the repo and building squidb from source to see if the problem is related to getting the artifacts from jcenter or if it's triggered purely by having the dependencies in general? Could you post just the small section of your gradle config where you add the squidb libs as dependencies so we can at least rule out anything fishy going on there? |
For now, we've put the code itself as module into the project, instead of using gradle-repo. |
If it works when building from source, I have to guess that there was probably something not quite right about how the configuration was set up, either with adding the dependencies themselves or in adding jcenter as a repository. You can double check that you've exactly reproduced all pieces of the config listed on this wiki page -- if anything from that sample was missing it would cause problems. Without being able to see your config or reproduce the problem though I'm afraid there's probably not much else I can do to help. |
I can say that both me and my team manager tried to use the gradle repo using the instructions, and it didn't work as on the POC. |
"The other file?" I'm not sure what you mean. That wiki page is based on our sample app's gradle file. All those things are indeed in the same file, which seems to be working fine. It's possible you are using a different project organization than we are, or have different gradle conventions. Again though, without being able to see the config or reproduce the problem in a sample project, I'm afraid I'm really just out of ideas. I'd be totally happy to give it a look if you can create a non-proprietary sample project with a large number of dependencies that exhibits the same issue. |
When you create a new project, you get a global gradle file, and one per module. |
Ah, I see what you're saying. Yes, you can put some of those things in the global gradle file, and you're right that in many cases you should, but we have often run into cases where we want to build certain modules in isolation or where the global gradle file is not available. In such cases we put all the things needed to satisfy the dependencies in the module's gradle file, as seen in the documentation. Again, your configuration may be different. Without an error message or a sample project demonstrating the issue, there's really no way to know the cause of the problems you're seeing. |
ok, we will send you the gradle files, but can you please do it via email instead of here? |
Sure! I've been meaning to set up a squidb-support email address for this kind of thing, so I will do so tomorrow. |
It might take me a bit longer to set that up, so for now you can email to sbosley [at] yahoo-inc.com. |
Sent. Please let me know when you got it. On Mon, Mar 21, 2016 at 9:39 PM, Sam Bosley notifications@github.com
|
Hey @AndroidDeveloperLB -- I was actually just able to reproduce this issue. The TL;DR version -- I think it's an Android Studio bug. When working with a library project which had a dependency on the squidb 2.0.0 artifacts, I upgraded them to the 2.0.3 artifacts and got the same issue you have been having. One thing I noticed was that building from the command line seemed fine, but Android Studio was missing the symbols. In other words, gradle was able to download and use the dependencies just fine, but for some reason they weren't being added to the classpath in Android Studio. I don't know why the solution I stumbled on worked, but for me it worked when I added the squidb artifacts to the main app's build.gradle file instead of the library project's build.gradle file. I also noticed that other projects (like LeakCanary) have had similar issues reported. Given that both building from the command line and adding the dependencies to the main app build.gradle fixed the issue when I encountered it, my best guess at this time is that it's a weird Android Studio bug. Feel free to give any of the things I've suggested here a try and let me know how it goes. |
I don't understand. How do I fix this issue? On Fri, Apr 15, 2016 at 11:58 PM, Sam Bosley notifications@github.com
|
I'm saying it's likely an Android Studio bug that's out of our control, but I was able to get the symbols to reappear in Android Studio by declaring the squidb dependencies in the app's build.gradle file, rather than in the library's build.gradle file. You can try that to see if it helps. |
What to put exactly? On Sat, Apr 16, 2016 at 12:37 AM, Sam Bosley notifications@github.com
|
@AndroidDeveloperLB
|
@AndroidDeveloperLB @jaredsburrows when I encountered this once and dug into it, I think it's the same kind of issue that some users of LeakCanary reported (see this issue). The fixes suggested in that thread resolved the issue for me without the need for any mavenLocal or gradlew install steps. |
@jaredsburrows I meant if there is a solution to use gradle files (only) to have the 3.x version of squidb. |
@AndroidDeveloperLB What do you mean "gradle files only"? Also there is a PR to merge 3.x here: #180. |
@jaredsburrows Meaning I won't have to clone anything. Just edit the gradle files to use this library. |
@AndroidDeveloperLB Yes, so skip all the steps in my previous message and add
|
I'm talking about version 3. What do I put exactly in the gradle files to On Thu, Jun 16, 2016 at 5:03 PM, Jared Burrows notifications@github.com
|
Just change the version number.
|
Version 3 has not officially been published as a stable release, but we did upload some beta artifacts recently. You can use this:
|
@sbosley We might want to add that to front README.md so users can easily find and understand how to install the library into their project. |
@jaredsburrows it's already in the README; the first section is a link to the wiki page entitled "Adding squidb as a dependency" that explains in more detail how to use the apt plugin, etc. |
@sbosley I know. I am saying add the block of code instead of the link so users can know this answer right away. Look at all of Squares and Jake Wharton's README.mds, https://github.com/JakeWharton/butterknife. Also, can we close this issue? |
@AndroidDeveloperLB has the question you raised in this issue originally been sufficiently resolved? Can we close this issue? |
@sbosley I tried to add this into the dependencies of the build.gradle file of "app" :
But then I get this error:
Trying to add the lines into one of the modules that the app uses, I get this error:
I tried it on the library module, because currently I have the next lines there (which were replaced by the lines you told me), as I've cloned the squidb module:
However, I've succeeded replacing what's possible, and now this works :
In "squidb-android" module, I had to change the gradle file to have :
So I think the only thing left is the "squidb-android" module to be in the gradle file of the app. So, it's not resolved. I still don't get how to properly use this repo in the project. |
@AndroidDeveloperLB Sounds like you forgot to add the android-apt plugin to your app build.gradle. And you should have just replaced Try adding the following in both your library and your app's build.gradle:
|
@sbosley Using this was enough (instead of what I used) :
So, now it's resolved. Please do update the main page of this repo, so that all people could use the beta version using gradle. |
@AndroidDeveloperLB glad this is resolved. We'll be updating the readme and documentation when we release stable versions of the 3.0 artifacts, probably later this week. |
Thank you. Wish I could be notified about repo-updates. |
@AndroidDeveloperLB In fact, it's easy to watch and be notified pretty much any project or repository that publishes its artifacts to jcenter. The page for squidb is found here: https://bintray.com/yahoo/maven/squidb/view. There's a "watch" button there that should allow you to be notified when new versions are published. And of course you can use the github "watch" button to be notified of things like pull requests, etc. |
Nice. I hope other repos websites will support this. |
Say, the bintray website shows just this: compile 'com.yahoo.squidb:squidb:3.0.0' Is it now just one line to add to gradle file? If so, this doesn't work. EDIT: This is how it should probably be:
|
Bintray only generates samples to add a single module at a time. That's why we include different instructions in our documentation. Anything on the bintray page is generated by them and may not be correct or complete for squidb. |
Can I at least assume the number there is correct and should be the exact same one as in the instructions? And that it will get updated when you upload a new version? |
Yep! We always keep the version number in sync for all modules, so you can always use the latest version number it shows there for everything. |
Thank you. You are great. On Mon, Jun 27, 2016 at 5:35 PM, Sam Bosley notifications@github.com
|
I have a large project, with a lot of dependencies and modules.
For some reason, on a POC it works fine, but when using the large project, all it gets is the annotation library ("squidb-annotations-2.0.0").
I've performed the same exact steps as on the POC.
How could it be?
The text was updated successfully, but these errors were encountered: