build.gradle changes for Android FCM - android

I am trying to incorporate push notification in my Ionic app (on ionic 1.3.1) using plugin phonegap-plugin-push.
Once I add the Android app to Firebase it tells me to update the build.gradle files in two places.
I find two build.gradle files in my Ionic project (another one is part of another plugin so ignoring that)
./platforms/android/build.gradle
./platforms/android/CordovaLib/build.gradle
I have played with making changes in different files, put the first change in first file, second change in second one, but I am not sure what I am doing here as it gives compilation errors when I run ionic build android. All the articles I have come across in my research point to using Android Studio which I am not using. And I am not sure what to do with the Synch now as instructed by FireBase.
I have placed the google-services.json for android from Firebase under platforms/android in my directory structure which I understand is the right place.
Look forward to any guidance on which build.gradle change goes where and what, if anything, I need to do with "sync now" in the context of Ionic App and get this up and running.
Thanks,
Sanjay.

It make sense that two changes happen in two files.
But for the app level one, you may write at the wrong one.
Please make sure you edit these two file.
enter image description here

I followed the recommendation in this article https://github.com/fechanique/cordova-plugin-fcm/issues/83
I removed all changes to my build.gradle files as they are supposed to synch automatically and it compiles fine.
That said, I am using the phonegap-plugin-push plugin (instead of cordova-plugin-fcm as in the article above) and my app crashes after it tries to init PushNotification but that is a separate problem I need to handle.

Related

How do i prepare my ambient for a Android Studio Native project?

I have a problem and I would like your help :)
I received a native Java project from Android Studio and I want to know how I can configure my environment, the first time I tried I had a lot of errors with gradel.
Is there a way to know exactly what settings are needed to start project maintenance?
As long as you have installed Android Studio and are able to create sample projects, you should be set up.
Gradle should show you all the problems which your legacy project has. I assume, that you will see a lot of warnings which can be ignored at first.
You might have problems with a missing key.properties file.
Some dependencies might not be available anymore.
You have to resolve all the issues manually. There aren't any special settings.

Flutter/Dart - What do these red letters in my AndroidManifest.xml mean? Are they errors?

I'm getting red letters in my AndroidManifest.xml and don't understand what they mean. At the moment everything seems to be working as should. But will I get any problems down the road?
Nope, Android Studio can't understand the Android content when a Flutter project is opened.
It can either understand the Flutter directory structure when Flutter is opened. This is what enables Code Completion and other nice features when making Flutter apps.
If it's a simple Android project, then it can easily understand the Gradle files and your Java/Kotlin.
What this means for you as a Flutter developer is that, when you are editing native Android or iOS code. You will not get code completion. Android Studio will not be able to tell you about the errors in your code.
The Flutter team is working on this. So that you can have all the cool IntelliJ features for editing Native code EVEN when you have a Flutter project is opened.
Also, I think if you open the android separately, then you should be able to see properly. (Maybe, I'm not sure).
You can now open the Android part of your Flutter project by right clicking on the project name in the project window, choose Flutter and then Open Android module in Android Studio.
The opened Android project will have code completion and all the red letters will most likely turn other colors :)

Kotlin files not recognized in Flutter app

I am working on a Flutter app inside of the latest stable version of Android Studio. I need to use a native SDK in this project since that vendor does not yet support Flutter. The example I am working off of was using the old support libraries and that was causing trouble so I am migrating things to androidx. I notice though that as I attempt to fix the errors in an Activity, like Unresolved reference: AppCompatActivity for example, that Android Studio does not recognize the Activity as a Kotlin file. In other words, none of the hints that show up work and in fact, no typo is ever shown as a syntax error. It's treating the Activity like a plain text file! You can type anything you want (like this_is_clearly_a_syntax_error as a line by itself) and no highlighting of an error will occur.
How do you get the Kotlin files to be treated like they do in a normal Android app?
Looks like you have to go in an physically mark the android directory as Source. So, go to File->Project Structure then select Module on the left. Left click on Android, then select Source then hit Apply.

Change name of Android project on Github

I have a single Github repo that contains 5 Android projects. Say one of the projects is named ToysGift and I want to change that project name to ToyDrive. How do I do that?
I am using Android Studio. Can I just change the name of the project in Android Studio and then push to Github? Git always proves challenging for me that's why I am asking first before trying different things because once I break what I have, I won't know how to get back to a good git state.
Did a quick test, Just changing the project name in android studio and then pushing should work, just make sure you have everything pulled so there aren't any conflicts.

Android Git: Making one project and doing changes

I am working on an android project that have later to be translated to many other languages and some changes have to do in design.
Now I want to know is there any way to make one project and keep it on git and later having changes should change the git project accordingly. So is it possible to create multiple apps for Android project. If yes, is it possible with Eclipse and git or someone has any other idea?
For the time being I am saving project in local directory and copy that project to make changes for next app.
This sounds that you should give git-subtrees a try. There, you create one repo with your base project and then import this repo into your specific app project. If you want to propagate your changes to the API, you push the changes to the base repo. We use this for component development.
But from my experience: do not use eclipse for working with git. It has some major drawbacks and might corrupt the repos. Use the CLI or another tool.

Categories

Resources