In an android project, when you install library with gradle
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
Is there a way to look at the source of the library?
edit
https://developers.facebook.com/docs/android/getting-started
Talks about the sample code is included in the sdk. How do I view this sample source?
You can see the source code and the samples of Facebook Android SDK on GitHub:
https://github.com/facebook/facebook-android-sdk/
https://github.com/facebook/facebook-android-sdk/tree/master/samples
you can to initialize FB sdk 4.0 in sattings.gradle file
include ':app', 'FacebookSdk'
it will load whole SDK.
but still it gives you just iml file. it just pulls everything dynamically when called.
----------- Edit ----
I just tried rightnow,
If you are using android studio,
Just select your project explorer, as Project. generally its Android.
it that you will see whole list.
I can see facebook folder with all of its classes.
Let me know if it works for you.
Here in my project i have initialized FB SDK 4.0.
Related
I was unable to include the Facebook Android SDK in the normal way so I downloaded a jar and added it to Android Studio. For some strange reason I get an error Unresolved reference: FacebookSdk even though I can see the class in the Project view:
If I am doing the wrong thing can somebody please give a lucid explanation of how to download and use the Facebook SDK in Android Studio 3.
Edit
I need to use the Facebook SDK in my app and I need to download it and add it 'offline'.
this is the sources package (as it's filename may hint for), which is for reference only. you should possibly add a dependency to the build.gradle instead; it's from the mavenCentral() repository, you can also find the artifacts here ...and a whole lot of other Facebook SDKs here.
dependencies {
implementation "com.facebook.android:facebook-android-sdk:4.36.0"
}
and also move those sources outside of the libs directory
(they still can be linked together with the fetched library).
I've followed this stack overflow answer to try and get OpenCV android working in Android Studio. I have followed the directions with the following caveats:
The build tools version in the opencv build.gradle is 19.1.0 instead of 19.0.1
Instead of looking like the picture provided after a gradle sync, my project structure looks like this:
When I open the module dialog, opencv appears as a model, as well as app
The project builds and autocompletes fine. However, I get the following error when the code that requires OpenCV is called:
java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.core.Mat.n_Mat:()
I have no idea what I am doing wrong. Any help is appreciated.
You have to explicitly load libs with LoadLibrary:
http://developer.android.com/reference/java/lang/System.html
I am using facebook integration API in my code. I have created sha1 key for Facebook,I got my APIID ,but the problem is that when I am trying to add facebook library in my project it's adding fine ,but when I am running it, its giving me NoClassDefFoundError error and library is not adding properly, where am I doing wrong?
Here is the image:
Here my facebook library is not adding properly, What should I do ?
Your facebook SDK library project and your Current Android project both should be in same directory. Try moving your facebook sdk library to your project's folder then it will 100% work properly.
For future reference always remember that your library project must me in same folder where your appliction is.
Try this:
Go to Project/Properties/Java Build Path/Order and Export -- Make sure there's a check in front of Android Dependencies and the support library, if you use it.Mark all checkboxes and Click on Apply and clean the project.
Hope this helps.
Move your Facebook SDK library to your project's work space then it will 100% work properly.I think they both are not in the same directory , and you are suggested to check the other imports of any other project of your work space and put the Facebook SDK same as the others.
I like to integrate Box.Net for cloud access in my android application. I found source code for box-java-sdk-v2 and box-android-sdk-v2 in https://github.com/box. But I would like to have jars for easy integration. Where can i get these jars?
Download box-android-sdk, build it, & then add jars to your app.
If you want to integrate Box in android (eclipse) then just follow these steps.
Download box-android-sdk
Download box-java-sdk
Now import the two projects in your eclipse
Set the box-java-sdk as build path in your box-android-sdk
Now set the box-android-sdk as library in your android project
My code works perfectly on eclipse. I have created a new project on Android Studio and added my classes, I have also followed this popular tutorial answer How can I create an Android application in Android Studio that uses the Google Maps Api v2?
Now the code doesn't show any red flags and it detects the imports fine but when I build the project I get these errors:
Gradle: package com.google.android.gms.maps does not exist
Gradle: package com.google.android.gms.maps.model does not exist
On a side note I have attempted to import the MAPS sample project like the tutorial says and that has worked fine but I do not know why my new project gives me these errors even though I have followed the tutorial to the letter.
Any idea guys?
If you created a new project (which uses Gradle) and then followed the tutorial, it's completely wrong.
When using Gradle (which new projects do by default), you cannot use the UI to add dependencies. You need to add them manually in build.gradle.
It's a crappy solution right now and we're working to make this better.
In short words:
Run Android Studio
Create new project
Create new module of Android Library type, remember to set the package name to com.google.android.gms
Copy res, src folders and AndroidManifest.xml file from google-play-services_lib (you can find it in your SDK folder if you installed it using SDK Manager) to the appropriate folder in your library module ([Project]/[Library]/src/main)
Remove android-support-v4.jar from libs folder under your library module, live only google-play-services.jar and google-play-services.jar.properties files there.
Make sure your build.gradle file in library module contains following:
dependencies {
compile files('libs/google-play-services.jar')
}
Make sure your build.gradle for application module contains following:
dependencies {
compile files('libs/android-support-v4.jar')
compile project(':[LibraryModuleName]')
}
Make sure your settings.gradle contain following:
include ':MapStudio', ':[LibraryModuleName]'
You can grab layout and manifest settings from Google Maps API v2 tutorial
Keep in mind that android-support-v4.jar is neccessary only when you want to support Android v2
You can find more detailed description on my blog.
I have tried and failed many a tutorial on this, but finally find a simple solution that seem to work.
I just installed Android Studio 0.2.3 on my mac, and these are the steps that made me view a maps fragment on a fresh hello world project template:
1) Click the SDK manager button in the toolbar in Android Studio.
2) Under 'Extras' locate 'Google play services' and install it.
3) in your build.gradle file in your src directory, add this line to dependencies:
compile 'com.google.android.gms:play-services:3.1.36'
4) order and install your API-key following this tutorial: https://developers.google.com/maps/documentation/android/start#the_google_maps_api_key
5) add the fragment to your layout xml:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"/>
6) you should now be able to run your project on your device.
For those of you completely confused by everything going on with implementation of external libraries to gradle projects i have the easiest and most reliable solution.
Step by Step Guide: http://aetherstudios.net/pages/gradle.html
this might be a bit of work but it is the most reliable way i have found to get it done.