How to remove package from for GCM configuration? - android

I am using THIS PAGE to generate configuration file for GCM APIs.
I accidentally added a duplicate staging flavored package name: stag apart from staging. I wonder if there is any way to remove it? I cannot find the package list in Google develop console anywhere.

If you go to the Console -> Manage all projects there should probably be a project that relates to your incorrectly entered package. If you delete the project, the package will no longer be visible in the list (be sure not to delete something thats actually needed :P).

Related

Firebase android distribution won't allow applicationIdSuffix

When running ./gradlew appDistributionUploadDevDebug I get an error saying it can't find the app.
The culprit is having applicationIdSuffix = ".dev" in my dev flavor. Removing it allows the apk to be uploaded, but then the artifact wouldn't be built properly. For the record I plan using only the dev flavor for internal distribution.
I get an error message saying I should enable app distribution, but since this is done on a "firebase project" level and it's done for the main flavor I can't do it again.
* What went wrong:
Execution failed for task ':app:appDistributionUploadDevDebug'.
> App Distribution could not find your app 1:xxxxxxxxx:android:0b3f<xxxxxxxxx>.
Make sure to onboard your app by pressing the "Get started" button on the App Distribution page in the Firebase console:
https://console.firebase.google.com/project/_/appdistribution
Documenting this as a bug, I'll add a reply since I found a workaround.
Edit: expanded name of gradlew task that was shortened. Though it works it may make for easier searching.
Workaround:
To fix open app/google-services.json and look for the mobilesdk_app_id key for the main package name.
For example in my case I noticed that 1:xxxxxxx:android:0b3f<xxxxxxx> was the value for the package with the .dev suffix, while the main package name (without .dev) shows under 1:xxxxxxx:android:7eb88<xxxxxxxx>
So heading to app/build.gradle, the firebaseAppDistribution block would look like this
firebaseAppDistribution {
appId = "1:xxxxxxxx:android:7eb88<xxxxxxxx>"
I still think this is a bug in firebase distribution. Sounds like the distribution gradle code is picking the right value, but the distribution server is not compatible.
BTW When the developer wants/needs to have 2 separate firebase projects you need to download 2 separate google-services.json files, and place them in the appropriate flavor folders. I also have a (2nd and 3rd) app that shares a project with that setup, but haven't added firebase distribution yet to check how it behaves.
For reference, my workaround worked while providing a serviceCredentialsFile. I also tried using the web token authentication but my results were inconclusive.
I thought that would be the case, but it turns out that you have to enable app distribution for each apk (buildType and/or flavor).
When selecting a project on the firebase console, the page automatically selects one of the apps and I was just enabling app distribution for that one.
There's a dropdown at the top where you can select another app (build/flavor), and you have to go to each one individually and enable app distribution.
I hope this helps someone else.

How to create firebase project with the same SHA-1 key as used in another project?

Is it possible to create two Firebase projects with the same SHA-1? because I have an android project created already and the installed application are targeting that project, now for some reasons I need to use another project for the newer versions of the same applications so the existence of both firebase projects is necessary.
But I wonder how would I do it with the same SHA-1 because it gives me error and I am not able to find a way?
The error message says:
An OAuth2 client already exists for this package name and SHA-1 in another project
Read the error message carefully. It says it's using both the package name of the app and the SHA-1. This means you can have the same SHA-1 in two projects, but the package names of the app (also called "application id") must be different. Likewise, you can have two projects that have the same package name, but they can not have any of the same SHA-1 added to them.
The combination of package name and SHA-1 must be unique.
Create a copy of your project and change the project package name everywhere, and keep the Sha1 It should work.Create another project in firebase and add it.

Update Google Play services from 8.x.x to 9.x.x

I have a working Android app using:
Google Maps (play-services-maps)
Google Location, Activity Recognition, and Places (play-services-location)
Google Analytics (play-services-analytics)
Google Mobile Ads (play-services-ads)
I'm currently using version 8.3.0, everything works fine. I'd like to upgrade to the last version, 9.2.0. When I change the number in the gradle files, Android Studio is unable to find the APIs packages & classes (saying "package XXX does not exist" and "Cannot find symbol class YYY").
I currently have no google-services.json file, do I need it now? I tried without success, probably because I have several modules / submodules, and I don't know where the json file is needed or not.
The problem is that I need a package name to create the JSON file, and I have some library modules, without package name, using Google APIs.
If needed, here is the project structure:
Maybe you did something wrong while upgrading your project. Make sure you follow the correct steps in upgrading. I suggest you to retry the process of upgrading, but make sure you do the correct way. Like in configuring your build and setting up Google play service.
For your question about google-services.json, Google-services.json contains developer credentials and configuration settings, which is needed to verify while connecting with GoogleApiClient. Though your service is working fine without it. But it will only work with your test device, as it is detecting your developer account. And after you releae your app in public, it will not work without the json file. So you need it and don't delete.
sources: What does google-services.json really do?
So, I finally got it: I was using the AutocompletePrediction.getDescription() method, which has simply been removed (and replaced by AutocompletePrediction.getDescription .getFullText()). That call made gradle stops building -_- .
Thanks Google for removing stuff without deprecating it for a while (though the docs says that the method is deprecated: https://developers.google.com/places/android-api/releases)...
I can also confirm that in my case, the google-service.json file is NOT required.

Does Firebase Cloud Messaging depend on the package name?

I want to know if package name, defined on Firebase project console, is tightly related to Firebase Cloud Message successful delivery or it's just a helper for creating google-services.json file.
On Firebase console, once created it can't be renamed.
In my case I created a project at Firebase console named, by mistake, son.example.firecm instead of com.example.firecm as defined on my Android Studio Project.
My Android project was not compiling cause gap on spelling at google-services.json.
Once renamed package name to com.example.firecm, it compiled but not sure if it will receive Firebase Cloud Messages or not cause difference between Firebase console project package definition at Android Studio project.
Having the right package name is important for several services, though not FCM specifically, other than getting it right in the google-services.json as you found. FCM uses the project number to identify the app, which will be read from the JSON file.
The best thing to do is just to connect a new Android app to your Firebase project with the correct package name, and download the updated google-services.json. It wont hurt to have the other package name connected (and once the console allows deleting connected apps, you should be able to remove it).
Well I did further research on the same.
I found that if package name defined on Firebase Console isn't the same as defined on Gradle and Manifest of the APP, then the APP won't be able to receive Notifications sent from Firebase Console.
In guess that in some way it's logic that package name must match in order to Android lunch the correct APP once notification arrives.
To sumarize, it's mandatory that both names matches.
I invite to test by yourself and keep and eye on package names for project success.

Adding google maps library to existing project creates confusing error

I am building an Android app that I want to open google maps with the click of a button. I want the app to find the current location of the user and give them directions to a predefined address. I started building the application before I realized there were special steps that you have to take to include this functionality. To add this feature to my project I followed the directions on these two sites:
https://developer.android.com/google/play-services/setup.html
https://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
The problem is on the second site, when i added the library to my already existing project it caused all of my code that has findViewById(R.id.whatever) or setContentView(R.layout.whatever) to become errors. It is now telling me that i need to import the class R. If I do that it then gives me error messages on the names of all my xml files.
For example in my MainActivity it is telling me that i should change setContentView(R.layout.activity_main) to setContentView(R.layout.activity_list_item) and does this for all references to my xml files for the entire project.
I tried going back and removing the google play services library from the project and starting over but when I removed it the errors still persists. I also tried using the "fix project setup" option in Eclipse but it didn't fix the problem.
I'm wondering if anyone here has experienced this problem before? If so, how can I fix it? The application had no errors before I tried to include the google play services library. I am new to Android development so a lot of the information I have found has been either confusing to understand or doesn't seem to include enough details for me to figure it out. Thanks for your help!
Look at your imports, and check if you are importing the correct R.java from your application package, not from the android package.
Check also if your XMLs don't contain errors, otherwise R.java won't be generated.
In my case android-maps-library had to errors in two files (I have forgotten their names), I edited the two files removing errors my self. And finally I was able to used it quite nice.
i think you have correct yout Project build target, and this how:
right click on your project folder in the package explorer->propreties->Android
then porject build target and choose you Android target (Android x.xx)
but before that you need to remove import android.R;

Categories

Resources