How to import SupportPlaceAutocompleteFragment into an Android Studio project - android

I need to use Android's SupportPlaceAutocompleteFragment in a project, but for some reason Android Studio complains that Can not resolve symbol SupportPlaceAutocompleteFragment. Am I missing something in my gradle file:
compile 'com.google.android.gms:play-services-maps:7.5.0'
compile 'com.google.android.gms:play-services-location:7.5.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
compile 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.google.android.gms:play-services-ads:7.5.0'
I checked the documentation here but there was mention of which library is required to use this fragment.

SupportPlaceAutocompleteFragment requires Google Play Services 8.4 and you are using Google Play Services 7.5.0
Use :
compile 'com.google.android.gms:play-services:8.4.0'
or
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
Reference : New AutoComplete Widget.
Here is Sample Project for implementing the same.

From what I could gather from a quick look at the documentation, you might be missing the Android Support Library reference in your project. Go to tools->Android->SDK Manager and under extras check if you have the Android Support Library installed, if not install it. Also, add a reference to it in your gradle file like this compile 'com.android.support:support-v4:23.1.1'.

Related

Android Studio Weird Warning

After I updated my Support library from 23.1.1 to 23.4.0 I get this warning cannot access android.support.v4.app.baseFragmentActivityEclair on every call to super and every instance of AppCompatActivity
And if I updated my support library to 24.1.1 The warning changes to cannot access android.support.v4.app.baseFragmentActivityJB.
Can anyone tell me why this warning is shown and how can I remove this warning:
here is my dependencies before:
(no error in this)
compile 'com.android.support:palette-v7:23.1.1'
compile 'com.android.support:gridlayout-v7:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:cardview-v7:23.1.1'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityEclairwarning:
compile 'com.android.support:palette-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
here is my dependencies after cannot access android.support.v4.app.baseFragmentActivityJBwarning:
compile 'com.android.support:palette-v7:24.1.1'
compile 'com.android.support:gridlayout-v7:24.1.1'
compile 'com.android.support:support-v4:24.1.1'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.android.support:design:24.1.1'
compile 'com.android.support:cardview-v7:24.1.1'
We ran into a similar problem when one of the packages in our project had dependencies on version 24.0 support libraries and another package was dependent on version 23.4.0. This seems to be a problem for the Android Studio (IntelliJ) IDE, not the compiler, because we were able to build and run the project without any problems. We resolved the warning by reverting the 24.0 dependency to 23.4.0. I suspect that going the other direction (advancing all of our package dependencies to 24.0) would also have eliminated the warning but we didn't experiment with that due to the number of packages in our project.
If you're looking to hack around this, many of the support libraries have an internal library called libs/internal_impl-$VERSION.jar that includes these types of version-specific implementations. To get your IDE to work, you can extract these JARs and manually include them in your IDE's build path.
For example, you can extract the classes referenced here, assuming version 24.2.1, using this command:
unzip support-fragment-24.2.1.aar libs/internal_impl-24.2.1.jar

FCM integration in android, Why Firebase importing everything?

I have recently added FCM to my project and it's working fine. I have used
compile 'com.google.firebase:firebase-messaging:9.0.2'
this line for the library since messaging service is only required. But when I have seen the external libraries dir there are many firebase classes which have no use in my app. Please see the image below.
Edited : Here is the whole dependency clause
dependencies {
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'org.apache.httpcomponents:httpmime:4.3.6'
compile 'org.apache.httpcomponents:httpcore:4.4.3'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.firebase:firebase-messaging:9.0.2'
}
apply plugin: 'com.google.gms.google-services'
You are including more libraries than you need because you are using the general play-services library and not using the split libraries like play-services-drive or some other specific library.
By using play-services:9.0.2 you are saying you want to include all libraries in Google Play services including all the Firebase ones.
Removing the play-services:9.0.2 dependency and replacing it with a specific one like play-services-drive:9.0.2 (depending on what APIs you want to use) should fix your issue.
I believe since you don't add the core lib dependency explicity. The messaging dependency downloads all of the Firebase one.
Try adding the core and messaging both to limit the things to messaging part
compile 'com.google.firebase:firebase-core:9.0.1'
compile 'com.google.firebase:firebase-messaging:9.0.1'

Android studio getting stuck when run project

I have update the google play service version to 7.+, this version is required for GoogleApiClient, After updating google play version when i run project it will take much time and stuck entire computer.
Please guide.
thanks
Make sure to use required Google API in project. What you need in your project.
dependencies {
compile 'com.google.android.gms:play-services-plus:8.3.0'
compile 'com.google.android.gms:play-services-base:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-maps:8.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
}
Note: Do not use complete google dependencies
dependencies {
compile 'com.google.android.gms:play-services:8.3.0'
}

I have trouble configure android studio header file

I have the driver install, but i do not see what the problem is.
Problem is in your gradle file
make sure you added this dependencies
compile 'com.google.android.gms:play-services-gcm:8.1.0'
compile 'com.google.android.gms:play-services-location:8.1.0'
compile 'com.google.android.gms:play-services-maps:8.1.0'

Android Studio: Could not find any version that matches com.google.gms:play-services:6.1.+

I've recently updated my android studio and when I try to sync my gradle file I get the below error:
Could not find any version that matches com.google.gms:play-services:6.1.+
I understand that Android Studio ships with it's own sdk so I've installed the ADT sdk and pointed my project to this but I still get the same error, here are my gradle dependencies:
dependencies {
compile 'com.android.support:appcompat-v7:20.+'
compile 'com.path:android-priority-jobqueue:1.1.2'
compile files('libs/Parse-1.4.2.jar')
compile project(':ws_wrapper')
compile project(':custom_slider_library')
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.google.android.gms:play-services:6.1.+'
compile project(':shinobicharts-android-library')
compile files('libs/shinobicharts-android-trial-1.3.5.jar')
compile files('libs/androidplot-core-0.6.1-SNAPSHOT.jar')
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.2.jar')
compile files('libs/twitter4j-core-4.0.1.jar')
}
I'm unsure as to what to do next, my sdk manager is up to date, does anyone have any ideas? I can't run this at the moment due to this issue.
If I try to add a dependency via the project structure the google play services isn't available on the maven drop down list.
Just to add this line #integer/google_play_services_version in the manifest is also causing an issue it says cannot resolve symbol
Your SDK isn't actually up-to-date. You need to install revision 12 of the Google Repository; that's the one that ships Google Play Services 6.1.11.

Categories

Resources