setting up google play expansion file library in android studio - 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.

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.

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

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

How to import 3rd party binary library in Android Studio 3.4?

Backgroud:
I would like to use a third-party library in Android Studio 3.4. The library includes three files:see pics
arm64-v8a/libAnalyticsLib.so
armeabi-v7a/libAnalyticsLib.so
StrideAnalyticsLib.jar.
The class files within "StrideAnalyticsLib.jar" show that they seem to be generated by using SWIG.
I've tried two ways to import this library but still cannot
import StrideAnalyticsLib.*;
But this doesn't allow to access the classes and shows "cannot
resolve symbol ...".
the .so files are with jniLibs
~/main/jniLibs/
~/main/jniLibs/arm64-v8a/libAnalyticsLib.so
~/main/jniLibs/armeabi/libAnalyticsLib.so
the .so files are within libs; At the same time, i added "sourceSets { main{ jniLibs.srcDirs = ['libs']}}" in build.gradle;
~/libs/
~/libs/arm64-v8a/libAnalyticsLib.so
~/libs/armeabi/libAnalyticsLib.so
Both attempts are followed by cleaning and rebuilding the project.I'm very new to Android and couldn't get it work. Could anyone please provide help? Great Thanks!
After I studied the process using SWIG to wrap c/c++ library into the .jar and .so., I realised that the .jar and .so will have same package name so that the .jar can call the .so file.
Because my .jar doesn't work when it's saved in /libs, I instead copied all classes within the .jar and pasted them into the /main folder. Remember to put them outside your package, otherwise the package name of these classes will be changed, which cause my problem. The way of importing .so is correct. Just put the .so files inside /main/jniLibs.

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().

Resources