Gradle Project Dependency - android

I have ran into a little problem with very late wanting to move on to gradle with my intellij android project.
Now I have got some trouble with the dependencies. I already know how to add dependencies from given repositories.
I have a whole project in our libs folder, that also is an android project. Now I'm not really sure where/how to put this or whether it is possible to tell gradle that there is a whole project as a dependency. I have to say that the second project is not using any buildscripts so it is not a Gradle-Project.
As for now it is just a directory in our libs folder, and I think it's closer to some kind of sourceSet, but as I'm still new to gradle and I was not lucky finding anything related to my problem I hope you could help me out with a little hint.

Related

How do I update the build.gradle script names when cloning a project in Android Studio?

There's a great description on how to copy a project in Android Studio, which I followed with 99% success: Android Studio - How to copy a project?
However, there is one small sticking point I'm worried will bite me in the butt later -- In the project structure panel, the build.gradle scripts still refer to the old version of the project (GPS_Mark3) instead of the new one (GPS_Mark4). I have tried refactor / renaming everything I can think of, rebuilding the project, cleaning the project, syncing with Gradle files, closing / reopening the IDE... How can I fix this? Or, is it just a weird quirk I should forget about and doesn't matter?
Here's what I'm talking about in an image.
Thank you CommonsWare for the speedy comment!! You nailed it. I checked the settings. gradle file and changed the rootProject.name to reflect the name update to my app.

How can a valid (Project) build.gradle not show in 'Android' view?

In Android Studio 3.0.1 Project window I select Android then expand Gradle Scripts
Normally the top of the list shows build.gradle(Project:XXXX).
It does not appear, but choosing Project window Project Files confirms it's existance.
I have laboriously compared this project's home directory to that of a 'good' project but nothing stood out.
The project was created from a recently forked repo via
File > New > Project from Version Control > GitHub
The project builds correctly, honoring my changes to the project build.gradle.
This question may have been asked elsewhere but remains unanswered, so I am re-asking it with additional information!
Any insights or new avenues to explore would be appreciated.
Update
I have removed Versioning for this project and the problem persists. Have removed GitHub tag for this question.
For me this worked fine.
1. Close the project using Close project option.
2. Import the project newly from android studio.
You can delete .gradle and .idea folders in your project manually and reload your project, it helped me.
I eventually circumvented this bug by simply renaming the project folder!
Re-creating the problem has proved impossible, but I strongly suspect a synchronisation problem in an obscure little file called project.dat.
Please refer to the answer I gave to the aforementioned question here!

Android Studio: set as a Project

I'm new on Android Studio, and I'm still learning to importing libs and modules.
The thing is I have created my project as usual but in some point I lost the "project" gradle file and no I have only modules.
I wonder why none of gradle files have the "Project" word. In fact I'm interesting in the file build.gradle (Module:Swipe) to (Project:Swipe)
Question
How can I set the file build.gradle (Module:Swipe) changes to (Project:Swipe)
Not sure I understand your question...
It seems like you are missing the Project gradle file. I dont know what caused that.
To add a new one, just copy one from another project and edit it (it needs to be located on the project folder)
*Maybe it will be easier on the project pane. see here how to change to project panel:
http://i.stack.imgur.com/l4nm5.jpg

How can I add a support library to android project from command line?

I was getting so annoyed with eclipse and how it runs for android that I recently switched to just setting up my projects from the command line (actually terminal I am using Ubuntu 14.04), and the SDK is really very easy to use this way and I find the process less vexing as a whole. One problem though. I can't figure out how to add the support libraries to the project. Of course I have copied the relevant library into the libs folder but how do I add it to the build path? For some odd reason when I looked on the Android developers site it covers this question for eclipse users but not how to do it from command line....
Of course I have copied the relevant library into the libs folder but how do I add it to the build path?
If you are using Ant, just having it in libs/ adds it to your build path.
If you are using Gradle, instead of copying the library, refer to the artifact from your top-level dependencies closure:
dependencies {
compile 'com.android.support:support-v4:19.1.0'
}
If you are building some other way, please edit your question to explain how you are "setting up [your] projects from the command line".

Gradle: error: package does not exist

I know that there are different solutions with different libraries posted. But, could anyone help me with this one?
I've busting my head for the past couple of days, and I really don't know what to do. I already tried importing the modules in all the suggested ways from different posts. (Project Structure --> Dependencies --> Add dependencies), etc. My project does not show any errors, but when I run it, it throws me a compilation error that complains about some classes missing. The library only depends on the ViewPagerIndicator's library which I also imported.
here is a picture. Thanks!!!
NOTE:I also have tried it with Eclipse, but the problem is different there. The app crashes when I run it. When I uncheck isLibrary from Properties -> Android and erase those libraries, the app works.
Inspired by this answer, these are the steps I did:
Put the jar file (in my case, 'xxx.jar') into the libs folder of your project
Right click it and select Add as library
Type this in the dependencies part of build.gradle file: compile files('libs/xxx.jar')
Do a clean build. It can be done inside the android studio, but I also ran the gradlew.bat included inside the project folder
Now, the project should be built and run just fine.
You are referencing the library wrong. You need to add the dependency in the build.gradle file. I recommend you to read the documentation first. It's a long read, but totally worth it.
I noticed that a user uploaded the library as .aar file in his maven repo. You might want to use the library from his repo. The setup is very easy (you only need to include the dependency of the better picker library).

Categories

Resources