I am working on an Android project that needs three versions of the same application (for example: Admin version, User version, Custom version). I have already created a Google-App-Engine endpoints backend in the User version of the app. I have to start working on the other two versions now and I want to connect these two versions to the backend I created in the User version. I have tried finding the answer to this on the internet but I haven't been successful in doing so. I believe it is possible to connect the other versions of the app to the backend by importing the endpoint libraries from the cloud into the android projects somehow but I haven't been able to find a way to do so yet.
I did come across a way to import an existing module in the Android project but if I do that, then any time when I make changes to the backend in the "User" version, I will have to re-import the module in other versions of the app. I am so lost and confused.
Any help will be deeply appreciated.
Thank you!
After you build your cloud module there is a YOUR_CLOUD_MODULE_NAME-android-endpoints.jar under YOUR_CLOUD_MODULE_NAME/build/libs.
You can copy this jar into libs directory of all your android projects that need to interact with your back-end.
This approach makes it really easy to get out of sync though. After every change to back-end you would need to update the .jar in all dependent modules.
Are all of your Android applications in the same Android Studio project? If so I think you might be able to just add
compile project(path: ':{yourBackendModuleGoesHere}', configuration: 'android-endpoints')
to each of your Android apps build.gradle.
You could probably also make it work even if your backend is in a separate AndroidStudio project as long as they're part of the same gradle build.
Related
I have an apk and ipa, I was wondering if it is possible to inject Firebase analytics to them. Similar to other wrapper applications that allow to inject their code into an apk or ipa. Is this possible with Firebase? I have not been able to find information regarding Firebase injection.
I won't tell you that it's impossible to add Analytics to an existing APK, but what you're trying to do definitely isn't supported by Firebase. The only supported course of action is to add the SDK at compile and build time.
If you wanted to add the SDK after the app is built, you would have to go through the trouble of decompiling the APK, modifying the decompiled app components to include the SDK, then rebuild the APK altogether. There is no way to easily "inject" the SDK into an existing app.
I have built a project with all Firebase features including Firebase Performance Plugin. Now we are trying to make it as Library, While trying to convert from Application to Library we are facing an issue from Firebase as
ERROR: FirebasePerformancePlugin must only be used with Android application projects. Need to apply the 'com.android.application' plugin with this plugin.
May I know the reason why I am facing this issue. I am excepting a quick reply from the Team.
Thanks in advance
As the error suggests, Firebase Performance Monitoring is not supported for libraries, only apps. You currently can't use the product to collect performance information for you library if it gets integrated into other apps. You can only use it for monitor the behavior of a specific app that's added to your Firebase project.
If this is not what you want, you can file a feature request with Firebase support. Though, for this request, I suspect nothing will happen in the short term.
Using android studio, I created an app and linked it to a Firebase project.
I opened the app on my android studio recently and discovered it wasn't linked to my Firebase project any longer. I checked the Firebase console and saw that the app was still connected. However, it's still not reflecting in my android studio.
When I try to connect my app to Firebase (afresh), I can clearly see my Firebase project as one of the options (with one app connected ==> my app).
In summary, how do I reconnect an app to firebase?
I have tried restarting my android studio, cleaning the project, invalidating cache and restarting.
As long as there is no external tampering with an android studio project, an android app would always remain connected to Firebase.
I was able to solve this problem by signing out of all my Google accounts and then signing in with the account associated with the project. All I had to do after was attempt to reconnect again and kAbOoM, it worked fine.
There are two extra checkers/fixes I'd recommend to anyone that runs into this problem:
Check whether the google-services.json file exists. It's usually in the /app directory of android projects. If this file does not exist, it means the app is not connected to any Firebase project. One can then proceed to connect one's app to Firebase either manually or on the android-studio IDE. If the file exists, proceed to 2.
Dependencies: A lot of Firebase-type problems stem from dependency issues. Ensure the following:
Avoid version conflicts Ensure that all dependencies are up-to-date Take warnings seriously, they are like seedling-errors
I hope this helps other people who might run into this error.. Merry coding!
I'm really new with android developing. But I know how to upload a library to GitHub and include it in an android project. Recently, I'm working on some android apps, and I realized that I need to use some layouts and classes for all the apps. So, I created an android library and kept that inside all the project files. Then I came to know that I can simply upload that library to GitHub and use it for all the projects. But I'm not sure if it's a good idea. Is there any advantage if I upload it to GitHub?
In general, using a source control (git or other ones) is always a good idea given that your local filesystem can crash or you may want to revisit certain revisions you made to your project. Github is very popular and hosts several highly used projects, so it is no doubt a good place to upload. However, you must know that if you don't have their paid account, the project will be public (at this time, free accounts don't have a way to create private projects). Are you developing as hobby and do you mind if others see / take the code and reuse (hopefully under the licensing terms you specify)? Or is that something you're doing for an employer? In that case you should consult with the employer if this is OK.
Now as for sharing this module across projects, I don't think github has a secret sauce here. You could always build your library once and drop it in as dependency into all your apps, without having to copy its source code into each project. You may also want to look into integration with maven / gradle build systems, which Android Studio uses. For example, third party libraries often are available as downloadable libraries from maven central, and you can add a couple of lines to your build.gradle to go fetch a specific version of your library from maven central, rather than manually adding that library jar to the project that is using it. If your library code is on github, there are ways to publish to maven central from github ( http://datumedge.blogspot.com/2012/05/publishing-from-github-to-maven-central.html ) but I don't have experience with that step.
I tried to add Firebase to existing project with quite complex setup (2 variants, +2 dev) and was wondering, how google-services.json should be used? Is there manual way of adding service config? I had the same problem with GCM, it works fortunatelly but I spent quite some time digging on stackoverflow.
There's a new post on the Firebase blog about the relationships between apps and projects, and how that relates to your Android build variants. Hopefully it will demystify how things work. At the very least you should know that you can have all your Firebase apps defined in a single google-services.json that can apply to each of your variants (if they're all in the same project), or you can put a whole different google-services.json file in your project for each variant, if they are in different projects.
Do you use Android Studio?
You use Android Studio and Gradle and then
you can use google-services.josn file.
The google-services.json file is generally placed in the app/ directory (at the root of the Android Studio app module)
You can set both GCM and FCM .
The Google Services Gradle Plugin