Where to define "repositories" in eclipse project - android

I'm following a tutorial to integrate facebook sdk in my android project, I'm using eclipse currently , tutorial is asking me to define repositories { mavenCentral() } in build.gradle file , but I don't know in which file I've to add this in eclipse... ant.properties, project.properties or any other file?
I've read some related threads , but I could not find in which file I've to change.
Defining Repository in Maven
maven repository eclipse project

You are working in Eclipse and the tutorial asks you to add the Maven central to your Gradle configuration which you (properly) don't have in Eclipse.
You basically have two options:
Get a Gradle plugin for Eclipse (like this: http://marketplace.eclipse.org/content/gradle-integration-eclipse-44)
Get Android Studio (http://developer.android.com/tools/studio/index.html), where Gradle is already an integrated part of the IDE.
Both options means that you have to get your head around what Gradle does, and how it works, but it'll properly be worth the effort.

Related

I am facing issues compiling my project in Android Studio due to gradle

I have been trying to compile an app in Android Studio and it was working fine until I tried to add mobile ads.
Information about AS:
Android Studio Electric Eeel | 2022.1.1 Patch 1
Build #AI-221.6008.13.2211.9514443, built on January 21, 2023
I am following this article from Google Devs: https://developers.google.com/admob/android/quick-start#kotlin
I have read many questions and answers here on stackoverflow and also forums and blogs. The majority are from 2016-2021 and I understand a lot has changed since then...
According to the article, I have to include Google's Maven repository and Maven central repository in both my buildscript and allprojects sections on project-level build.gradle file.
My project-level build gradle contains a plugins { } section and when I paste the code form the article I get an error message saying that buldscript { } should be before plugins { }.
So I change that only to receive an error message saying "Build was configured to prefer settings repositories over project repositories but repository 'Google' was added by build file 'build.gradle'".
Following the article, I enter my module build.gradle file to add dependencies and I also update the AndroidManifest.xml with the information provided (I also have my actual AdMob ID).
I am also updating my MainActivity.kt file to include the necessary entries to preload Google Mobile Ads SDK.
But I am not able to compile anything anymore. I tried to move the buildscript{} and allprojects{} parts to the module build.gradle (within the app folder) but then I get following error:
A problem occurred evaluating project ':app'.
Could not find method android() for arguments [build_l8adkk1ea3ur5qn0u7k2w4gx$_run_closure1#20be5c4a] on project ':app' of type org.gradle.api.Project.
I have updated gradle to the latest version through Android Studio.
I have the latest version of Android Studio.
I have also specified the minSDK and targetSDK according to the article.
Not sure what to do or what the problem is. And all the solutions provided in various blogs/forums and here on stackoverflow seem outdated.
Thank you in advance

Import or use Android Studio projects in Codenvy IDE

I am trying to use Codenvy to develop, and I am switching from Android Studio. I am in the middle of a project. How can I transition? Can I use a special import feature? I have already tried to copy and paste the code, but a lot of libraries don't seem to be there. If you need to take a look at my source code, then just search up "calc-nigma" in Github search and you can click on the option that is made by beekaydev.
Thank you in advance.
The Problem is not with your code but the dependencies Codenvy is using is Maven while it seems that your application may be using Gradle dependencies.
For the Support of Answer:
Maven uses pom.xml file to build your project.
Gradle uses build.gradle file to build the project.
If you want to move your project to Codenvy try migrating your Gradle build to Maven build using this thread Migrating Gradle build.gradle to Maven pom.xml.
Hope this Helps!

How to make it possible to add my Library on GitHub to Android Gradle Files?

I have a project hosted on GitHub at https://github.com/BoardiesITSolutions/NavigationDrawerManager.
I've seen some projects on GitHub state adding it to their gradle file in Android Studio to the dependencies section but this doesn't seem to be working for me.
I have tried compile: 'com.github.boardiesitsolutions.NavigationDrawerManager:+' but it keeps saying it can't find it, I've also tried replacing the + with the version number but no luck, Android Studio keeps saying it can't find it. I've added the repository MavenCentral as well.
Is there something I need to do from GitHub to make it accessible for Gradle?
I don't see it on maven.
You can use this website to use non-mavenized libraries with Gradle.
Just add maven { url "https://jitpack.io" } to repositories section of build.gradle and use compile 'com.github.BoardiesITSolutions:NavigationDrawerManager:0b14c84445' in dependencies.

integrating maven dependency into android Eclipse project, no JAR file

Ok, so, I'm developing an app for the Amazon FireTV, so I have to use Eclipse.
I'm trying to use this socket.io Java client library: https://github.com/nkzawa/socket.io-client.java
at the bottom of this post, i included the installation instructions, which I'm not really sure how to make work with my existing Eclipse project (I'm new to maven). so from my understanding, do i just add a pom.xml file and a test folder? Then paste in their "maven central code" into the pom.xml? Will this cause any issues with the other code in my project? Or, can I just copy and paste all their SRC code into my project, since it's MIT licensed? I'd rather learn how to do this the proper way. The project is not in JAR format, so I was thinking maybe copying the folder structure into my project then using the Project Properties, Add Library option to connect to my code? Maybe?
Their installation instructions, (available in their readme.md):
The latest artifact is available on Maven Central. Add the following dependency to your pom.xml.
<dependencies>
<dependency>
<groupId>com.github.nkzawa</groupId>
<artifactId>socket.io-client</artifactId>
<version>0.3.0</version>
</dependency>
</dependencies>
Or to install it manually, please refer dependencies to pom.xml.
Add it as a gradle dependency for Android Studio, in build.gradle:
compile 'com.github.nkzawa:socket.io-client:0.3.0'
So, I learned that Maven Central has JAR files available for download. That way, you can just include them in your project via the Project Properties dependencies options. Without having to learn Maven.
You need to first understand how Maven works (and what pom.xml stands for). Maven is a tool that helps you automatically install dependencies (files need) for a given project. E.g if a project needs to process json files, it will need to "import" a json library which will then be a dependency for that project. When you add the dependency file above to your project, and run Maven install, it goes and fetches all the dependencies for your socket.io-client to work.
Unfortunately, Maven does work very well in building android application projects and can be fairly complex to setup correctly (from my limited experience). I would advise that you manually download the jar dependencies and then add them to your android classpath if you are not keen on investing a lot of time learning to use Maven.
To manually install the files .. you can create a default maven project (http://www.tech-recipes.com/rx/39279/create-a-new-maven-project-in-eclipse/) in eclipse, add the dependency file above to your pom.xml and run Maven-install. This will download the dependencies you need to your Maven local repository. You can then copy them from there to your android project.
Regarding installing the socket.io client you can find more on these steps here
http://denvycom.com/blog/socket-io-java-android-without-maven/

add library from Git to Android Studio

I know this must be a pretty basic question, but I'm new to Android Studio and gradle, and I can't find any up-to-date info on this.
I'm trying to add this library to my project: android-segmented-control.
It doesn't look like I can add it to my build.gradle file (correct?). I'd like to do it that way, of course, and not download the project if possible.
If I do need to download the project, how do I link it up with my existing project? Again, I haven't been able to find anything that is current that describes this process for Android Studio 0.5.3
The library you mentioned does not seems to be pushed on maven central or any other maven repository. As this library contains resources files, you cannot add it as a jar.
The only way to use it is clone the git repository and add it as a module to your android app project.
Meanwhile, you can ask the author to make it available on a Maven repository like OSS sonatype
Thanks #Thomas Bouron for the hint !
I have pushed my library to maven center, so you just need to add the following dependency to your build.gradle.
dependencies {
compile 'info.hoang8f:android-segmented:1.0.0'
}
(A little late for #workInAFishBowl but it may be helpful for others.).

Categories

Resources