I tried to add facebook-android-sdk by file -> import -> new -> module -> facebook-android-sdk-4.20 -> facebook. added successfully
but error occured "core 1.0 depends on one or more android libraries but is a jar."
Created New libgdx project.
Then I added facebook-android-sdk gradle module from https://github.com/facebook/facebook-android-sdk added successfully
but error occured "Error:Could not get unknown property 'ANDROID_BUILD_SDK_VERSION' for project ':facebook' of type org.gradle.api.Project."
So how to do this?
And do we need to add separate Facebook-SDKs and dependencies for all projects or Libgdx will do it automatically?
I'm using Android studio-2.3, build tools 25.0.2, compile sdk version API 25.
Add this to your build.gradle in the dependency section of the android sub project:
compile "com.facebook.android:facebook-android-sdk:4.20.0"
Alternatively you can have a look at or just use: https://github.com/TomGrill/gdx-facebook/ and see how it is done there.
Related
I am completely new to android studio and android development. I followed the instructions from the project page inside the app center. When I try to apply the first step:
Add the SDK to the project
In your app/build.gradle add the following lines:
dependencies {
def appCenterSdkVersion = '4.1.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
}
I get the following error in android studio:
Could not find method implementation() for arguments [com.microsoft.appcenter:appcenter-analytics:4.1.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I found this all depends on gradle and it's version but I couldn'd find a version that makes the error disappear
Current gradle versions
I figured that I did put the the dependendcies into the wrong build.gradle file (project instead of module). After moving the lines to the right file and forcing a gradle sync everything works.
I've been trying to add the volley library to my android project by downloading this repository https://android.googlesource.com/platform/frameworks/volley and then importing the module to my project by following this guide:
First get latest volley with git (git clone >https://android.googlesource.com/platform/frameworks/volley).
In your current project (android studio) click [File] --> [New] -->[Import >Module].
Now select the directory where you downloaded Volley to.
Now Android studio might guide you to do the rest but continue guide to verify >that everything works correct
Open settings.gradle (find in root) and add (or verify this is included):
include ':app', ':volley'
Now go to your build.gradle in your project and add the dependency:
compile project(":volley").
When gradle tries to sync the project after I've imported the module i get the following error message : Error:Could not download layoutlib-api.jar (com.android.tools.layoutlib:layoutlib-api:24.3.1): No cached version available for offline mode.
I believe you want to use Volley and not contribute to the volley library. if that is the case there are better ways to get volley in your project. let Gradle handle it. Gradle is Build Management tool just like Maven but better, As it gives you more freedom and flexibility.
How to add libraries to gradle in android studio. this link shows a how to add libraries to your android project.
As Android Studio uses Gradle things are pretty neat as it uses the middle ground of ANT and Maven for Build and Management tool.
for volley you can add
compile 'com.mcxiaoke.volley:library:1.0.19'
to the app module of your project. this library can be looked up on Github
or you can do that using android studio's GUI, click on File -> Project Structure
example
I am new to Android Studio. I am trying to work using the android-map-utils library. But it is giving me the following error.
`Error:(64) A problem occurred evaluating project ':library'.
> No such property: sonatypeUsername for class: org.gradle.api.internal.project.DefaultProject_Decorated`
Can anyone help me with this issue and also tell me a easy way to import libraries in android studio?
I had a similar problem while I was migrating from eclipse. I resolved my issue by using the gradle method of including the library (as opposed to importing it as a module and using it as a dependency).
Add the following dependency to your Gradle build file:
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.3+'
}
source: http://googlemaps.github.io/android-maps-utils/#start
I wasn't able to comment.
Applying gradle dependency as link doesn't allow us to view it's source properly.
So if you are interested in viewing source too, in Android Studio itself
You should try adding library as a module project, i.e.,
File -> New -> Import Module -> (Dir of Library)
after importing, you'll face an error, which can be resolved from - Adding Maps Utils Module
I'm trying to import existing code (library) into Android Studio workspace according to this guide.
A have done everything step-by-step and Gradle refuses to synchronize project with error message:
Gradle 'MyApplication' project refresh failed. Error:Configuration with name 'default' not found.
Any ideas what went wrong?
You're following an outdated guide.
You should add a new module via File -> Project Structure then click the + button.
You then have various options to import libraries.
To include your library in another project add a compile project definition to your dependancies:
dependencies {
compile project(':mylibrary')
}
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.