I've got a weird issue with Android Studio. A number of import statements like
import com.google.android.gms.gcm.GoogleCloudMessaging;
import com.loopj.android.http.AsyncHttpClient;
They fail on the gcm and loopj parts. Yet if I build and run the project it works fine.
I've including them into my build.gradle.
dependencies {
compile ('com.android.support:support-v4:13.0.0', 'com.google.android.gms:play-services:3.1.36')
compile files('/libs/android-async-http-1.4.3.jar', '/libs/CWAC-SackOfViewsAdapter.jar')
}
Anyone have any idea why I'm getting the errors in the IDE?
I made a new project, and pasted in my files, and it worked fine. I guess this is a the problem with using software in beta :P.
Related
I'm followed some tuts for including the FB SDK
but when I want to import
import com.facebook.FacebookSdk;
I need this for FB analytics, so I'm created the class fbanalytic :
image here
and we see it's hidden i dont know fix it
and also someone his tell that class it's not important specialy in the latest version in fb sdk ,is that correct?
currently im using latest verion :facebook-android-sdk-4.22.1
Using the Facebook SDK:
Import the sdk by adding compile dependency to build.gradle file
dependencies {
compile 'com.facebook.android:facebook-android-sdk:4.+'
}
Now when you are trying to use something from Facebook's SDK it should be AUTOMATICALLY imported to your files.
In your example you are making a new Class that does uses AppEventsLogger that is part of Facebook SDK. The import statement that you presumably wrote (import com.facebook.FacebookSDK) is grey and second import statement clearly shows that it is importing form com.facebook.* SDK.
tldr: Android Studio imports from Facebook SDK as expected.
Add in build.gladle within dependencies bracket:
compile 'com.facebook.android:facebook-android-sdk:4.+'
Might be duplicate.
In build.gradle:
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
In my code:
import com.facebook.AccessToken;
import com.facebook.AccessTokenTracker;
import com.facebook.login.LoginManager;
I don't think this was an issue before, but all of the sudden today it's saying "cannot resolve symbol" for all of the import statements and so lots of things in my code are now wrongly marked as errors, even though when I run my app it works fine. What could be causing this?
tools>android>sync project files with gradle files
Try this:
Ctrl+Shift+Alt+S->selectApp->Dependandies->select"+"->moduledependandies->choose facebooksdk
After upgrading from the last Android Studio 2.0 preview to Preview 5 I'm having trouble with the imports from the android.support.wearable package.
Both the main app and Wear app builds and run just fine, but the editor in Android Studio complains that it can't resolve the these imports
import android.support.wearable.activity.WearableActivity;
import android.support.wearable.view.CircledImageView;
import android.support.wearable.view.WearableListView;
In the Wear module's build.gradle I have the following dependencies:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':common')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:support-v13:23.1.1'
compile 'com.google.android.support:wearable:1.3.0'
provided 'com.google.android.wearable:wearable:1.0.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
}
As I understand from http://developer.android.com/training/wearables/apps/always-on.html#EnableAmbient this should work when using the provided statement. And it has worked well until the Android Studio upgrade. Am I missing something?
Update:
This isn't just a problem with the Wear library, it's general for what seems to be any external dependency. (Topic originally was Unable to resolve package android.support.wearable in Android Studio 2.0 Preview 5.)
It seems like the problem can occur at any time, but in practice it happens mostly whenever I do lotsa changes in a class (maybe changes to the imports?). Just now it suddenly was unable to resolve the imports of Play Services and Facebook ads (while still working for other dependencies).
I accidentally found a workaround of the problem: If I open and build the project in Android Studio 1.5 which I also have installed, all the imports are fixed. Going back to Android Studio 2.0 I can continue programming without the imports becoming unresolvable for a long while.
For anyone googling the problem, the error message in Android Studio is the usual Cannot resolve symbol '[package]'.
I had this problem even before with AS 1.5, the easiest way for me to fix it was to use the Terminal inside Android Studio and execute:
./gradlew assembleDebug
This will work if you're not using flavors if not just use the name of the flavor, for e.g:
./gradlew assembleFlavorNameDebug
that should work too as a workaround without leaving your current instance of AS, and then the compiler recognizes your imports if everything is setup properly.
For more references please look: http://tools.android.com/build/gradleplugin
https://stackoverflow.com/a/21307568/799162
I am 'lucky' to have been charged with maintaining a program developed by someone else, and I come across the following problem with an import statement:
import com.fizzbuzz.android.dagger.InjectingDialogFragment;
which Android Studio cannot resolve. I am totally new to dagger...
I have the following in build.gradle dependencies:
compile 'com.fizz-buzz:fb-android-dagger:1.0.1'
compile 'com.fizz-buzz:fb-android-bluetooth:1.0.3'
InjectingDialogFragment is not available in the version you are currently using. Please use compile 'com.fizz-buzz:fb-android-dagger:1.0.3' instead.
For better understating on how Dagger works you can use this blog http://antonioleiva.com/dagger-android-part-2/
I am trying to use clustering in my application. However on the import statements I get 'the import com.google.maps cannot be resolved (clustering.Cluster).
Also, when using ClusterManager I get 'cannot be resolved to a type'.
The rest of the google play services are working fine.
Are you using Android Studio, or Eclipse? Might need to check your gradle file (Android Studio for example) to see if you have the library/module dependencies lined up. If you are using this library (https://github.com/googlemaps/android-maps-utils) for example, your gradle file should have something like :
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.3+'
}