I am stuck when trying to run my app with the FacebookSDK for Android included into my project in IntelliJ IDEA.
With a basic Android boilerplate, everything builds and runs fine. But as soon as I try to add the Facebook SDK to my project as explained in this post, I get multiple errors:
java: /Users/me/Projects/Android/facebook/src/com/facebook/widget/LoginButton.java:25: package android.support.v4.app does not exist
java: /Users/me/Projects/Android/facebook/src/com/facebook/widget/LoginButton.java:33:
cannot find symbol
symbol : class R
location: package com.facebook.android
Detailed screenshots:
Why is that and how can I solve it?
Download: You can download the test project here.
First, go to your Analytics for Apps page: Analytics for Apps. Then, click "Mobile App Installs” from the left-hand navigation, and check your last install reported to confirm proper installation of the SDK.
The Graph API is free to use, for all applicable use cases.
The problem with your project is that the Facebook SDK module has the altered AndroidManifest.xml
file that specifies the wrong package causing R.java
file to be produced in a different package, hence the non-working imports.
Original AndroidManifest.xml
file can be found here:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.android">
<application/>
<uses-sdk android:minSdkVersion="8" />
</manifest>
See also my answer regarding the proper android-support-v4.jar
dependency configuration.
Android support v4 is the android support library. It backports some classes to older versions of the SDK. You can find the jar in your SDK, under extras. You need to include it in your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With