Cannot import com.google.android.libraries.(anything) - android-studio

I am trying to add a maps activity to my android project using android studio, and I copied the code from developer.google.com which contains the documentation for retrieving the current location. But there in the import part there are some lines
import com.google.android.libraries.(something)
which is giving the error even though I edited the dependencies in build.gradle, but still it is not working
cannot resolve symbol libraries
any suggestions, thanks in advance

Try to delete .gradleand .ideafolder and sync the project again.
You can find above files in Project Window on the left side of IDE

Related

Add GitHub libraries in Android Studio

I want to add MathView in my project but it gives me an error. It says that it's not an existing version. Okay, Then I tried other library. But this one gives me an error too. It says: "Could not resolve all files for configuration". I think I have to add something to work with GitHub libraries. I did some research but all of the posts are very old and outdated. Can you guys help me add those libraries in my project.
implementation 'io.github.kexanie.library:MathView:0.0.6'
import this as (compile is deprecated).
Note. gradle has two files 1.build(project.PROJECTNAME)
2. build(module.PROJECTNAME.app)
inside 2. -> find dependencies{} ->
copy the implementation 'io.github.kexanie.library:MathView:0.0.6'
and sync you are good to go.

Cannot resolve symbol 'ImmutableList' in Android studio

I try to implement Google Play Pay but don`t know how solve this problem:Type of ImmutableList cannot be resoclved.
Should I import some package?
I have search with Google and no any question like this(Android studio)
ImmutableList.of(QueryProductDetailsParams.Product.newBuilder()
.setProductId("product_id_example")
.setProductType(BillingClient.ProductType.SUBS)
.build())
Android Studio suggests the firebase-crashlytics-buildtools dependency to import the ImmutableList class. Doing so resulted in a big increase of the file (bundle) size.
Try instead including guava as a dependency, if you are not using crashlythics in your app:
// graddle
implementation 'com.google.guava:guava:31.1-android'
// java class/code
import com.google.common.collect.ImmutableList;
This has a much smaller impact on the file size. In my case, the bundle was 2MB compared to 10 MB if using crashlythics-buildtools.
I run into the same problem. By hovering with the pointer over 'ImmutableList' I selected the entry Add dependency on com.google.firebase:firebase-crashlitics-builtools and import...
This action created the following line in the import section of my activity file
import com.google.firebase.crashlytics.buildtools.reloc.com.google.common.collect.ImmutableList;
and the following line in the build.gradle file:
implementation 'com.google.firebase:firebase-crashlytics-buildtools:2.7.1'
However, the word reloc in the import line initially appeared in red color with the hint Cannot resolve symbol 'reloc'. Then I noticed that in the build.gradle file, android studio was offering to change the version of the crashlytics-buildtools from 2.7.1 to 2.9.1. After doing so and syncing gradle, the word reloc was no longer red and ImmutableList was recognized correctly.
I wonder whether it is really necessary to import the firebase crashlytics-buildtools for the integration of the Google Billing Library (I use it for an app with in-app purchases) or if there is a more simple way to do this.

Android Studio Kotlin databinding: Unresolved reference on BR

I have some code that is generating a "red squiggly" error in Android Studio:
#get:Bindable
var title: String = ""
set(value) {
field = value
notifyPropertyChanged(BR.title)
}
It complains that "title" is an unresolved reference on BR.title. Building and running works fine though, and this is the only error I can see. I debug there and see that it's gotten the value for BR.title correctly.
Still, I can't figure out how to make it go away. I verified that the generated BR class has the "title" field, but Android Studio refuses to recognize this. I've looked up people having this issue and have tried the following: (unsuccessfully)
Closing Android Studio, deleting the .gradle, .idea and build folders and restarting
Build -> Clean Project, Rebuild Project
File -> Invalidate Caches and restart
Disabling and enabling the Kotlin plugin
Closing and reopening the project
I have also checked and I have apply plugin: 'kotlin-kapt' in build.gradle.
Anyone know what's going on? I assume it must be holding onto some cache files somewhere but I don't know where.
What fixed the problem for me was adding the following import to my files:
import androidx.databinding.library.baseAdapters.BR
I'm not entirely certain why this works, but it got rid of all the analysis problems and the application still compiles and works fine, so I'm personally happy.

Android Studio Error retrieving parent for item: No resource found that matches the given name 'Theme.AppCompat.Light'

I'm using Android Studio 1.5.1 and I did was i renamed a working project with a new package. After that, I encountered the problem i mentioned above.
I can't for the life of me figure out how to fix this. I've tried adding the dependency files already. All of the solutions points to editing build.gradle file but I don't have that file because this project is imported from a eclipse project. Can anyone help me please?
Regards,
Dexter
If you want to add dependency,follow the steps below.
1.file->new->Import Module.
after import module
2.file->Project Structure->app->dependency tab-> add library dependencies.
3.In build.gradle(your module) change to apply plugin: 'com.android.library'
if you get any error regarding min and target sdk versions, then choose 4th step other wise exclude 4th step(first 3 step enough).
4.file->Project Structure->example ->Flavors tab //change minimum and target sdk versions().

setting up google play expansion file library in android studio

I am trying to use apk expansion files in my android project, I've read this
http://developer.android.com/google/play/expansion-files.html
I tried to follow those steps, but I cannot figure out how to set up / include in my project / google play apk expansion library.
I've been searching for hours, didn't find right answer. Any help?
I just tried to set up the modules listed in http://developer.android.com/google/play/expansion-files.html today, but the play_apk_expansion/downloader_library cannot be imported as supplied.
The issue is a stale library reference in play_apk_expansion/downloader_library/project.properties
Update the last line from:
android.library.reference.1=../market_licensing
to:
android.library.reference.1=../../play_licensing/library
Note the extra ../
Then use File -> New -> Import Module... to import the play_apk_expansion/downloader_library as usual. It will also import the play_licensing/library as library but that can be renamed to something more useful afterwards.
I have not found a better way than importing via eclipse, so I have set up a github repo where this has already been done:
https://github.com/coltsoftware/ExpansionAPKsAndroidStudio
Copy sdk/extras/google/play_licening/library to Eclipse workspace
Copy sdk/extras/google/play_apk_expansion/downloader_library to Eclipse workspace
Eclipse: New --> Android project from sources to create two library projects from the above copied files. Don't forget to make the correct library reference to play_licening for downloader_library.
Android Studio: New --> Import Module, and import play_licening first, and then downloader_library.
To use Andrew's answer with Android Studio 2.1, I needed to update:
market_apk_expansion/downloader_library/project.properties
to
android.library.reference.1=../../market_licensing/library
before I could import the module as described.

Resources