I am in Android Studio and this is a NON GRADLE project.
I have installed google play services, and google repository through sdk manager. I have imported google-play-services_lib as a module and added the google-play-services.jar as a library.
Yet for some reason my android-maps-utils files can't find my play services references.
import com.google.android.gms.maps.model.LatLng
in com.google.maps.android.clustering.Cluster.java says model doesn't exist.I can see the file in the play services library inside my project as shown below:
So why can't this file pick it up?:
I had to add dependencies for my project and each of my 3rd party libraries.
In Android Studio File > Project Structure > Libraries > choose a library > on the bottom of the dialog there should be a + button. Click that and then add dependencies. I think I added them as libraries (whatever the second option was)
Related
I have downloaded a source of library but I really need to make it custom and change it in my own way, so I should import it as a module to my project manually.
Follow these steps:
1. Create a folder.
2. Drag or copy your library folder in created library in android studio.
3. Add the module to the settings.gradle like this:
include ':LibraryFolder:LibFolder'.
4. So sync it and clean project.
5. Go to project structure in Android Studio.
6. Add library.
7. Clean and run.
Be successful.
Eclipse has this neat feature where you can set one project to build path of another project so that you can separate the two projects as library and the application while maintaining the independence of editing these projects as desired.
This also helps as change in library project is immediately reflected onto application project
Now I want to do something similar for android studio , but the library that my android project is being built on is a java project in eclipse IDE.
Currently what I do is make some changes in library project eclipse then export it as jar file and then import it on android studio.
This is tedious as I want to develop the library project in eclipse alongside the android project and exporting and copying over the jar files manually is slow
Is it possible to do any of the following:
Setup eclipse project such that its build outputs/updates a jar in the libs folder of android project each time project is built in eclipse?
Link the Android studio project's build path to include the eclipse project
Edit the java project on android studio along side the Android project and link them both
Android Studio is the official integrated development environment (IDE) for Google's Android operating system, built based on JetBrains' IntelliJ IDEA software. Android Studio uses Gradle
In answer to your question
You have to understand Build Process with gradle in Android Studio.
You can import your Android project.
And Add your library as a dependency
Create an Android Library
Add as a dependency for your Andriod app modules or other Java projects.
I recommend reading this site.following Site
Projects Overview
I'm trying to install the supertooltips library and I fail every time.
I followed many tutorials, but I ended up with
Error:Configuration with name 'default' not found.
Are all the folders and files in the zip necessary, or do I have to put a specific folder in my library folder "myproject/mylibs"? And when I try to add the library from file>new>import module or right click project > new > module > import Gradle project and choose the library; it says project already contains module with this name "app" folder.
I'm using the Android Studio 1.5.
Just add this to your dependencies in your Module:app build.gradle:
dependencies {
compile 'com.nhaarman.supertooltips:library:3.0.+'
}
Simply add that line and then just rebuild the project and the library will be added.
After adding Google Play Services to integrate Google ads into my libGDX project in Eclipse, I can no longer use Gradle to build my Android project.
I know that's because I need to tell Gradle about the new Google Play project dependency so I added compile com.google.android.gms:play-services:5.0.89 to the dependencies section of the :android project however it complains that it could not find com.android.support:support-v4:19.1.0.
I guess that means I need to somehow tell Gradle this new dependency depends on another dependency?
Everything works fine in Eclipse so the dependency of my Google Play project in Eclipse is for sure golden, I just need to make Gradle the same way. Do I need to declare the Google play project as another Gradle project and make a build.gradle file for it? I don't think I should be touching the Google Play project contents at all.
If you have downloaded the tools and google reprositories using the Android SDK Manager (1st thing to check), check if your build.gradle files do not need to be updated (what libGDX version are you currently using?).
I had the same problem and solved it by replacing my Android's module build.gradle file by a brand new.
To do so, use the last ligdx setup ui (https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle) to create a fresh project then compare/replace gradle files.
Under your android module there's a build.gradle file. Add the following:
dependencies {
compile 'com.google.android.gms:play-services:6.1.11'
}
Check for the latest version of Google Play Services and update your version number accordingly.
I have an existing project that was built without gradle for Android Studio
and I'm trying to get Google Play Services imported to fix a
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable exception.
The only problem is it doesn't seem possible... I've considered porting it to
gradle but the codebase is rather large (40+ Activities) and it would be a
nightmare for someone like me, who's never used gradle before, to accomplish.
I've trying importing the Google Play Services project from the SDK but it
hangs forever "creating gradle files".
Anyone have any experience loading this library to a non-gradle project before?
As an aside, I've tried loading the project into Eclipse to see if I could do
something that way, but the build paths self-destruct to where I've spent hours
trying to sort through them to no avail.
Copy the library from the SDK/Extras Directory
Use your SDK Manager to download the Google Play Services - it'll be found under the Extras directory.
Go to your Android SDK directory and find the google-play-services_lib directory, for me this was in the Android Studio package:
/Applications/Android Studio.app/sdk/extras/google/google_play_services/libproject/google-play-services_lib/
Copy this entire directory to your project's libs directory.
Add this as a module dependency as you normally would. (For Android Studio, see below for step-by-step instructions.)
You'll need to add a meta-tag to your AndroidManifest.xml file as well, that looks like this:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Profit and Party?
Android Studio Steps
Steps to add the library project as a module dependency once it's already in your libs directory.
File > Import Module.
Select the google-play-services_lib directory under your libs directory.
Ensure Create module from existing sources is selected and click Next until you finish the wizard.
Project Structure > Modules (far left) > Select Your App > Dependencies tab > + > Module Dependency > google-play-services_lib.
Project Structure > Modules (far left) > Select google-play-services_lib > Dependencies tab > + > Jars or directories... > Find and select libs/google-play-services_lib/libs/google-play-services.jar.
Make sure you click the Export checkbox for this dependency.
Profit and Party?
Many thanks to Adama Speakman's post for the specific Android Studio steps.
JP