Firebase Unity Android: No google-services.json files found in your project - android

I am trying to add Firebase to my Unity project but somehow it keeps giving me an annoying error.
I've tried to use generate_xml_from_google_services_json.exe myself but that didn't fix the problem.
I also tried to edit the generate_xml_from_google_services_json.py python script to change the default location(which is set to a "normal" android app paths) but that didn't work either.
I followed the steps exactly from the Firebase docs and pasted the google-services.json fie in the root of the assets folder but it still gives me the following error:
No google-services.json files found in your project so it is not possible to
generate Firebase Android resources file google-services.xml.
Building without Firebase Android resources (google-services.xml) will result in an app that will fail to initialize.
To resolve this problem, follow the setup instructions at https://firebase.google.com/docs/unity/setup#setup_for_android
UnityEngine.Debug:LogError(Object)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:LogErrorIfEnabled(String)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:FindGoogleServicesFile(ConfigFileType, String, FindGoogleServicesFileMode, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadProjectFields()
Firebase.Editor.SettingsWindow:OnFocus()
UnityEditor.DockArea:OnEnable()
Did anyone had this error before(because I couldn't find anyone else with this problem) and how did you fix it?

Download a configuration file
Get a config file for your Android app
To download a config file for an Android app:
Sign in to Firebase and open your project. Click the Settings icon and
select Project settings. In the Your apps card, select the package
name of the app you need a config file for from the list. Click
google-services.json.
Add the SDK to your app
Add the GoogleService-Info.plist file to the project.
Navigate to the Assets folder in the Project window. Drag the
GoogleService-Info.plist downloaded from the Firebase console into the
folder. NOTE: GoogleService-Info.plist can be placed anywhere under
the Assets folder.

Related

Registering the app with firebase - "google-services.json" file and "build.cradle" file

I am reading couple of articles on using firebase in an ionic app. I have created a working Ionic / firebase integration app that uses the Ionic Cloud messaging feature to send notifications on app.
To achieve this (besides the app code) and to integrate firebase in the app: I created the firebase project and selected the android icon - this is to "add firebase to android app". Step 1 is the app name, Step 2 is downloading the "google-services.json". It advises me to place the file in the applications app directory.
Some articles advise placing the "google-services" file in the root app directory. If I do this I get error when running "ionic cordova run android" which says the "google-services.json" file could not be found.
What works for me and same is advised by many other articles I have read is - place the file in "Application/platform/android/app" folder. Here "Application" is name of my ionic project folder.
My question:
What is the best practice to place this file? Am I doing it correctly?
The next step after is - Step 3 Add Firebase SDK - which advises user to add certain lines of code to the (project-level) /build.gradle file or (app-level) //build.gradle - I do not do this yet everything seems to be working well for me. So is this automatically done when we run the "ionic cordova run android" command?
In your project you did:
ionic cordova platform add android#7
In which the structure of the project was changed, and now all the src, assets and all files needed to run the application should be inside the directory app. Therefore, the google-service.json file location is correct.
Regarding adding firebase sdk in the build.gradle file, you do not need to do that since if you are using this plugin FCM, it adds the firebase sdk in the build.gradle.
You can see that in the plugin.xml of the plugin:
<framework src="com.google.firebase:firebase-core:10.+" />
<framework src="com.google.firebase:firebase-messaging:10.+" />
more info here:
https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#framework

Android studio Cant find exploded-aar directory in project files

I cant find any folder name in my project with the name of exploded-aar .
i putted the view in project mode and still cant find it , in creative cloud SDK (Image Editor) we must to go in this directory :
/app/build/intermediates/exploded-aar/com.adobe.creativesdk/image/#.#.#/res/values/values.xml
but i cant find that!
in another words i want to customize Creative cloud SDK (image editor) strings but i cant find them, if anyone has the strings files in exploded-aar for just send that for me :)
thanks.
In the androidstudio 2.3 version
Google official make one more cache file replace exploded-aar
if you use it
you can open gradle.properties add
android.enableBuildCache=false
rebuild you project and clean it.
and you will find that you've found the file again

google-services.json" was found, but it indicates a project ID that you don't appear to have access to

In Firebase Option Android Studio when I click on "connect to firebase" I am getting the following error.
"google-services.json" was found, but it indicates a project ID that you don't appear to have access to. Request access or delete the file in order to proceed with the connection process.
I don't know how to request to access and delete. What should I do?
This error will occur if you are signed in to Android Studio and the Firebase Console with different accounts.
In Android Studio, click on the small profile icon in the upper right corner to see your sign-in account. Do the same for the Firebase Console tab of your browser. If they are different, sign out and sign in to make them the same.
For me, I had to navigate to the web console:
https://console.firebase.google.com/u/0/
and add my app as a project manually:
After clicking "ADD FIREBASE" it worked.
Just delete "google-services.json" file in "app" folder of your project and re-connect your app to Firebase with Assistant
Reason:
if you are signed in to Android Studio and the Firebase Console with different accounts
Or your JSON file is corrupted
Solution :
Use same account for Studio and console.
Delete the corrupted JSON and use Studio plugin to create the project, it will automatically handle the corner cases
For me, the problem was that I had a wrong "google-service.json" file in my project.
(I signed in to Android Studio & Firebase Console)
If you are like me, you need this.
① delete all "google-service" file. You can easily find it by [Ctrl + shift + n] and put
the file name in.
② Go to Firebase Console → Setting → App setting → app card below, now you can find  "goole-service.json" file that is customized for your project. Download it.
③ Copy the new file and paste it in your Project. (Project → app → here!!!)
④ Go to Firebase assistant and click "connect to Firebase"
In my case my URL of my main activity was different from that of my googleServices.json file. I will advise you to just copy from your googleServices.json file and paste in your MainActivity.java (Make sure both URLs are exactly the same).
\appname\.idea\modules\app\google-services.json
Delete this file in your project folder first.
In my case, I already had this file in my project files as I changed my package name, and I was trying the add the google-services.json file for the second time. And I was getting this error: -
> A config file "something\google-services.json" was found, but it
> indicates a project ID that you dont appear to have access to. Request
> access or delete the file in order to proceed with the connection
> process.

Error "File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it" [duplicate]

This question already has answers here:
File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it
(5 answers)
Closed 2 years ago.
I updated my project to the latest Play services classpath 'com.google.gms:google-services:1.5.0-beta2'. I am also using the latest version of playservices in my app.gradle file as:
compile 'com.google.android.gms:play-services-location:8.3.0'
compile 'com.google.android.gms:play-services-gcm:8.3.0'
However when I compile, Gradle throws exception as follows
Error:Execution failed for task ':app:processDebugGoogleServices'. > File google-services.json is missing from module root folder. The Google Services Plugin cannot function without it.
You need to get the configuration file from the developer's site and paste it in the app level directory of your project.
Update:
Goto
https://console.firebase.google.com/
Select your project
On the left menu, click on settings > project settings
Add an app or download the google-services.json file under the Your Apps section.
Please go to this URL :
https://developers.google.com/mobile/add
Choose your Options and finally you will be able to download
google-service.json file
copy that file and paste it Into
YourProjectName/app Directory
Then recompile the project Most probably it will fly
In my case the project directory looks like this :
For anyone using Firebase you need to go into your console and there it should say "add project to Android". From there, it will step-by-step generate the google-services.json file for you.
I received this error while trying to run Google's Firebase analytics sample app:
Prerequisites:
Download https://github.com/firebase/quickstart-android
Add quickstart/analytics to Android Studio
Add Procedure:
Go to https://firebase.google.com/
Click on "GO TO CONSOLE"
Click on "Add Project"
Project name: Enter: sample-app
Click "Create Project"
[Takes about 10 seconds or so...]
Click "Continue"
On the "Getting Started" page, click "Add Firebase to your Android app"
Enter package name for the android app
[The full package name appears at the top of the manifest: "com.google.firebase.quickstart.analytics"]
Click on download google-services.json
In file explorer, add google-services.json to the directory:
"quickstart/analytics/app"
[Warning: Do not rename the file, it must be: google-services.json]
Run 'app'
The sample app already contains the necessary Gradle file settings.
When adding a new project do: Tools -> Firebase -> Analytics -> Add
Event -> Connect App to Firebase.
Adding a project via Android Studio ensures that all the Gradle Dependecies are setup.
Remove Procedure:
Go to https://firebase.google.com/
Click on "GO TO CONSOLE"
Settings -> Project Settings -> Delete this App
Settings -> Project Settings -> Delete Project
Enter project ID and press delete
I added and removed the sample app multiple times without any noticeable side effects.
in my case i have saved a json file with a space like this
google-services .json
and the right one is
google-services.json
and also take care you do not put (_) instead of (-)
may help some one.
If you don't need it anymore…
…\build.gradle:
classpath 'com.google.gms:google-services:3.2.0'
->
// classpath 'com.google.gms:google-services:3.2.0'
…\app\build.gradle:
apply plugin: 'com.google.gms.google-services'
->
// apply plugin: 'com.google.gms.google-services'
You must go on Firebase console-->Settings-->Project Settings and there will be section with Download the latest config file. Download google-service.json and put into app folder. It's work for me.
Links:
https://developers.google.com/identity/sign-in/android/start-integrating
https://developers.google.com/android/guides/client-auth
I just run into problem downloading google-services.json from Firebase console. Turns out I had to log out from all other google accounts than the one I was using for Firebase.
For Cordova Apps:
We need to place the google-services.json file in app root (I believe; when working with Cordova apps, we are not to get into other folders/files such as Gradle, Java files, platforms, etc; instead only work with them VIA the config.xml and www folder) and refer it in the config.xml like so:
<platform name="android">
<!-- Add this line -->
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
NOTE: Ensure that the Firebase App packagename is same as the id attribute in <widget id="<packagename>" ... > are same.
For ex:
<!-- config.xml of Cordova App -->
<widget id="com.appFactory.torchapp" ...>
<!--google-serivces.json from generated from Firebase console.-->
{
...
packagename: "com.appFactory.torchapp",
...
}
Good Luck...
In android studio:
switch to Project view so you can see the actual project folder structure.
find google-services.json file and drag it to the app directory (for some reason when I added it using file explorer, it put it in the gradle folder).
Clean/Rebuild project.
It worked fine for me from there.
https://developers.google.com/android/
you need to generate configuration file which gives you access to all the services and APIs you registered for in developer console and place it in your root directory
Go to the configuration file from the developer's site and paste it in the app level directory of your current project.
Very Simple
Just go to Tools->Firebase->Connect to firebase than click on sync now
THIS WILL SURELY WORK.
Go to Tools-->Firebase in your Android Studio and click on Connect your app to Firebase. They will set it up for you.
Easiest way to add google-service.json file
In Android Studio follow these steps:
Click Tools > Firebase to open the Assistant window.
Click to expand one of the listed features (for example, Analytics), then click the Get Started tutorial to connect to Firebase and add the necessary code to your app.
I had the same problem. The problem is because of renaming the file. You might have downloaded N number of google-services.json files in your downloads folder. So when you download a new file it will download with same name but by adding numeric values in brackets. something like google-services(1).json .So you have to delete this (1) and copy the file. Make sure when you are renaming it, there should not be any spaces or extra . in the name of the file.
If you don't have access to the Firebase of the project, for example, you downloaded an example source code then you have to remove any Firebase related stuff to make the project run.
Search keywords in the project
List item
fabric
firebase
google-services
crashlytics
Even after adding all the dependencies and the file if you face any such problem it could be your incorrect file name of "google-services.json".
Make sure you have the exact file name without any additional spaces or characters.
I had renamed the file and had space" " in my filename which was not noticeable, later I found that my file name is wrong, so fixed it!.
https://developers.google.com/mobile/add
select get started and go to settings logo and then project settings
after that you will see below the platform like web,android,ios . select that according to your preference.
and then download
google-service.json file
copy that file and paste it Into
YourProjec/app Directory
and then finally sync again .
That Problem is because:- The folder or file you pasted to your product downloaded from the firebase console is not named as google-services.json. so now click it then right mouse click in all the options open refractor and rename it to google-services.json. because this worked for me
Had faced same issue ..
well in my case i have saved
google-services.json
as
google_services.json
I tried every solution mentioned above but nothing helps...
the error was instead of "_" you need to put "-"(dash).
Just refactoring the file to google-services.json from google_services.json works like charm..
Hope this helps!!!
P.S. I know it's sound silly but this only works for me...
Steps:
Navigate to your project folder and open the /app sub-folder.
Paste the .json file here.
Rebuild the project.
for people coming here from the firebase codelabs tutorial step 3:go to page 4.
Apparently, if google says You should now have the android-start project open in Android Studio. ,She means it,and not You should now have the android-start project open in Android Studio, without any build-errors .
As the instruction says there, you have to get a configuration file from firebase. i.e , create a new project in your firebase acc with name 'friendly chat and in the next page , add its package name and SHA1 KEY.
after downloading the json file,add it to your project>app folder, and Rebuild project.

Installing Android Studio issue with .gradle file

I just install android studio on a VM machine (VM Fusion). When I try to create a new project, I get the message "org.gradle.tooling.GradleConnectionException: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'.: Could not install Gradle distribution from 'http://services.gradle.org/distributions/gradle-1.6-bin.zip'."
I followed the suggestion found in the page.
Download Gradle directly from
http://services.gradle.org/distributions/gradle-1.6-bin.zip
Copy the contents of gradle-1.6 to
\Android\android-studio\plugins\gradle
Copy gradle.jar to \Android\android-studio\lib\
Restart Android Studio
It did not work. I get the error message
I tried to copy the zip package /gradle-1.6-bin.zip to the following location
C:\Documents and Settings\myusername.gradle\wrapper\dists\gradle-1.6-bin\72srdo3a5eb3bic159kar72vok\
the .gradle file was not there. I look in setting and notice that it under \vmware-host\sharefolders. I went there and the file was still not there. I unhide hidden file and folder with no luck.
In addition, when I create a new project, I notice the project location is \vmware-host\Shared Folders\AndroidStudioProjects\MyApplicationProject.
How can I get a new .gradle file or tell android studio to look at a different folder? How do I change the project location so it does not default to \vmware-host but instead to c:\development.
Any kind of help would be greatly appreciated.
Thanks,
JF
Copying Gradle inside Studio will not help. Just install it somewhere else and after manually creating a project you can import it in Studio and select which installation of Gradle to use.
You have to create the project manually, because right now creating a project from studio always use the wrapper that automatically download gradle from the online repository.
We are working on having an offline mode for project creation, but it's not available yet.
Just edit your System's DNS settings, and redirect services.gradle.com to 127.0.0.1 then use a small web server and serve the file under its appropriate directory (distributions)
As you said,"Copy the contents of gradle-1.6 to \Android\android-studio\plugins\gradle",this folder under the setup path.
Why did you copy it to "Documents and Settings"?

Categories

Resources