I installed different packages including (SDK) build tools and updated everything but nothing seems to be working, can any one help ?
Thanks in advance.
You should add this in your app gradle:
dependencies {
compile 'com.google.android.gms:play-services:9.6.1'
}
In Android Studio, left most side you can see set of options like Project, Android,Packages, Project files etc.
select Project --> external libraries..add your libraries in it and try
Related
I use the Android Studio 3.0, when I tried adding a library via Android Studio 3.0
project structure -> dependencies -> library dependency
My Android Studio is like this:
If you write down a fully-qualified dependency
(like this):com.facebook.stetho:stetho:1.5.0
When press an enter or click the 'ok'-cta, and after that, you click the 'ok' again,
Then the studio will add the dependency to your build.gradle file.
Sync your project, and that's all.
You are able to modify the scope before you add the new dependency.
Use implementation/annoitationProcessor/compileOnly/etc. as expected.
(https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations)
But, I think it is a better way to handle(add and remove) all the dependencies in the build.gradle file directly, and use this window for double-check the already used dependency.
I hope, it helps you.
i'm working with android studio and i have an issue... i import 2 libraries (facebook SDK and Aws) that both use and import the android support v4 libs, doing that gradle can't compile anything giving a bad top-level exception (dexDebug).
In others answer i saw that i can solve this situation in 2 ways, removing one of the libs (but i can't because i need both) or using the "multipledex = true" in build.gradle that give me another error for the length of the command.
So, what i should do? Shall i stop using AS and go back to Eclipse? Or anybody have a solution?
Thanks,
Andrea
Don't import the support library by copying its jar as you used to in Eclipse. In Gradle, access it via its Maven coordinates and the build system will ensure that only one copy gets linked into your project:
dependencies {
compile 'com.android.support:support-v4:X.X.X'
}
where X.X.X is the right version number for your SDK installation. If you manage the dependency via Project Structure > (your module) > Dependencies > + > Library dependency it will help you get the version number right.
I'm using Android Studio with an external Android SDK. I have installed the support library and the support repository. The support repository is in:
~/Development/Tools/android/sdk/extras/android/m2repository
When I add a dependency to the support library in the build.gradle file, like:
...
repositories {
mavenCentral()
}
...
dependencies {
compile "com.android.support:support-v4:18.0.+"
}
Android Studio cannot find the support libraries (cannot resolve symbol etc) and Gradle also cannot find the libraries:
Gradle: A problem occurred configuring project ':TestAndroidStudio'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':TestAndroidStudio:_DebugCompile'.
> Could not find any version that matches com.android.support:support-v4:18.0.+.
Required by:
TestAndroidStudio:TestAndroidStudio:unspecified
How do I specify in Android Studio and/or the build.gradle file the location of the Android support repository?
You are probably hit by this bug which prevents the Android Gradle Plugin from automatically adding the "Android Support Repository" to the list of Gradle repositories. The work-around, as mentioned in the bug report, is to explicitly add the m2repository directory as a local Maven directory in the top-level build.gradle file as follows:
allprojects {
repositories {
// Work around https://code.google.com/p/android/issues/detail?id=69270.
def androidHome = System.getenv("ANDROID_HOME")
maven {
url "$androidHome/extras/android/m2repository/"
}
}
}
Gradle can work with the 18.0.+ notation, it however now depends on the new support repository which is now bundled with the SDK.
Open the SDK manager and immediately under Extras the first option is "Android Support Repository" and install it
Found a solution.
1) Go to where your SDK is located that android studio/eclipse is using.
If you are using Android studio, go to extras\android\m2repository\com\android\support\.
If you are using eclipse, go to \extras\android\support\
2) See what folders you have, for me I had gridlayout-v7, support-v4 and support-v13.
3) click into support-v4 and see what number the following folder is, mine was named 13.0
Since you are using "com.android.support:support-v4:18.0.+", change this to reflect what version you have, for example I have support-v4 so first part v4 stays the same. Since the next path is 13.0, change your 18.0 to:
"com.android.support:support-v4:13.0.+"
This worked for me, hope it helps!
Update:
I noticed I had android studio set up with the wrong SDK which is why originally had difficulty updating! The path should be C:\Users\Username\AppData\Local\Android\android-sdk\extras\
Also note, if your SDK is up to date, the code will be:
"com.android.support:support-v4:19.0.+"
Android Studio 3
Make sure you have the latest version of Android Studio. The support library is included by default when you create new projects. If you are adding the Support Library to a project that doesn't have it, then you just need to add a single line to your app module's build.gradle file, and then sync gradle.
build.gradle
dependencies {
...
implementation 'com.android.support:appcompat-v7:27.1.1'
}
It should just be that easy, though there may be some things to note:
Android Studio should give you a warning nowadays if the support library needs to be updated. Just update the 27.1.1 numbers that I have here to whatever it tells you to. You can also manually check what the latest revision is if you want to.
The implementation keyword replaces compile that was used in Android Studio 2.x. (What's the difference?)
There are other support library packages that you may need to include depending on what your app uses (like constraint-layout or recyclerview).
Make sure that you have the latest updates for everything in the SDK Manager. Go to Tools > SDK Manager.
Documentation
Support Library
Support Library Setup
Support Library Features
I used to get similar issues. Even after installing the support repository, the build used to fail.
Basically the issues is due to the way the version number of the jar files are specified in the gradle files are specified properly.
For example, in my case i had set it as "compile 'com.android.support:support-v4:21.0.3+'"
On removing "+" the build was sucessful!!
Instead of doing this:
compile "com.android.support:support-v4:18.0.+"
Do this:
compile 'com.android.support:support-v4:18.0.+'
Worked for me
I'm trying to use the Parse library in Android Studio. I added the jar to the libs folder. Nothing seems to be working without the errors of
Gradle: error: package com.parse does not exist
in your build.gradle:
dependencies {
compile fileTree('libs')
}
You can use this solution.
1. You need Latest Android studio version (0.3.6)
2. Right Click on Your Project Folder,Open Module Settings (F4)
3. Modules->Dependencies
4. Click Add File Dependency.
5. Add parse jar file.
6. Wait for second. (Android Studio will add you library to build.gradle script)
7. Delete your build folder (TO clear cached)
8. Run It again.
I have imported my project from ADT and after going to "Module Settings" and editing dependencies things are working fine.
My "build.gradle" has dependencies block empty, So I am wondering from where is Ansdroid-Studio picking libraries dependencies ? As I migrated from eclipse so I have project.properties file in module directory. Does Android-studio pick these things from "project.properties" file ?
Android Studio's default project support is done through Gradle, unless you have an Android project coming from IntelliJ which you can open with Studio as well.
If you use Gradle, project.properties is completely ignored. You should not use the Module Settings to add dependencies now as it only changes the IDE but not the Gradle based build system (we'll fix this in later versions).
If you have missing dependencies in your build.gradle, it may be due to a bug in the export from ADT. We have fixes for this coming soon.
Probably not, since a new project on Android Studio does not generate a project.properties file.
Presumably in Android Studio that is not where dependencies are coming from, but I can't be too sure.