Comments (11)
Found the solution, the issue is occurring because
if (BuildConfig.DEBUG) { FirebaseDatabase.getInstance().useEmulator("10.0.2.2", 9000) FirebaseAuth.getInstance().useEmulator("10.0.2.2", 9099); FirebaseStorage.getInstance().useEmulator("10.0.2.2", 9199) }
here BuildConfig.DEBUG
is giving false when app build, that why the emulator is not connection with app, make sure BuildConfig is imported from Build generated file
from codelab-friendlychat-android.
Was anyone able to resolve this issue?
Update: I was using the wrong BuildConfig class, I deleted some BuildConfig Import, and it ended up using the local BuildConfig class from the project, which is the correct file.
from codelab-friendlychat-android.
The issue is something else I used my own Firebase account but getting same issue
from codelab-friendlychat-android.
"make sure BuildConfig is imported from Build generated file"
How?
from codelab-friendlychat-android.
"make sure BuildConfig is imported from Build generated file" How?
before pasting the above code on onCreate
method go to Build -> Rebuild project
it will create an Java (generated)
folder which contains the BuildConfig
file use that BuildConfig
from codelab-friendlychat-android.
The issue is something else I used my own Firebase account but getting same issue
Me too. I can't found the API KEY
from codelab-friendlychat-android.
"make sure BuildConfig is imported from Build generated file" How?
before pasting the above code on
onCreate
method go toBuild -> Rebuild project
it will create anJava (generated)
folder which contains theBuildConfig
file use thatBuildConfig
Can you please elaborate further? I bypassed the if (BuildConfig.DEBUG)
condition by setting it to True, but I still get an exception that the API key is invalid.
I believe the issue is lying with the key truly being expired/invalid, and not with the application logic.
from codelab-friendlychat-android.
"make sure BuildConfig is imported from Build generated file" How?
before pasting the above code on
onCreate
method go toBuild -> Rebuild project
it will create anJava (generated)
folder which contains theBuildConfig
file use thatBuildConfig
Can you please elaborate further? I bypassed the
if (BuildConfig.DEBUG)
condition by setting it to True, but I still get an exception that the API key is invalid. I believe the issue is lying with the key truly being expired/invalid, and not with the application logic.
Actually the key is truly invalid, but local emulator does not require any valid api key, so for time being use all the code inside if (BuildConfig.DEBUG)
without if
from codelab-friendlychat-android.
SignInActivity.kt
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// This codelab uses View Binding
// See: https://developer.android.com/topic/libraries/view-binding
binding = ActivitySignInBinding.inflate(layoutInflater)
setContentView(binding.root)
// Initialize FirebaseAuth
auth = Firebase.auth <-- Wrong code
}
Turns out I was having a code segment in the wrong place. Removing it fixed the issue.
There is nothing wrong with the API key at the time of writing.
Try comparing your code with the provided solution in the \codelab-friendlychat-android\build-android
folder
from codelab-friendlychat-android.
Hello its June 23 and I'm still having this same issue today. "E/AuthUI: A sign-in error occurred."
Turns out I was having a code segment in the wrong place.
this was definitely not my issue, but just to be certain I copied the whole SignInActivity and MainActivity from the completed version and pasted it onto my version. The difference I noticed was the code lab said to put some code into the onCreate and the completed one put it instead it onStart. Not sure how much of a difference that made but for my issue, it persisted nonetheless after doing this direct copy paste.
I was using the wrong BuildConfig class
This was also not my issue, I control click the class and see its from the appropriate "build" folder that was generated.
So, I'm stuck. How do i move forward? i would love some guidance here
June 24th update: I removed the google-services.json file and replaced it with my own after making a real project on firebase, thinking maybe something was up with my firebase emulator. But no, this still didn't work and gave me the same error. It said there was a network connection issue so i thought maybe i should try the app on a physical device instead of emulator to ensure wifi connection is there, but nope that did nothing too. So still stuck here. Before doing this codelab, i completed this one: https://developer.android.com/codelabs/advanced-android-kotlin-training-login#0
and everything went smoothly there so not sure whats up.
from codelab-friendlychat-android.
"make sure BuildConfig is imported from Build generated file" How?
before pasting the above code on
onCreate
method go toBuild -> Rebuild project
it will create anJava (generated)
folder which contains theBuildConfig
file use thatBuildConfig
Can you please elaborate further? I bypassed the
if (BuildConfig.DEBUG)
condition by setting it to True, but I still get an exception that the API key is invalid. I believe the issue is lying with the key truly being expired/invalid, and not with the application logic.Actually the key is truly invalid, but local emulator does not require any valid api key, so for time being use all the code inside
if (BuildConfig.DEBUG)
withoutif
if anyone else runs into this, just add buildConfig = true
to the buildFeatures
in app/build.gradle.kts
:
buildFeatures {
viewBinding = true
buildConfig = true
}
After that rebuild project via ide or run gradle clean build
.
from codelab-friendlychat-android.
Related Issues (20)
- I separated the Java and Kotlin version HOT 2
- default_web_client_id HOT 2
- Replace startActivityForResult
- Add more stringent Cloud Storage rules HOT 1
- If done to exact spec, App will crash on launch. HOT 2
- Include code for goToMainActivity()
- No instruction on `private fun signIn` in SignInActivity.kt
- mock-google-services file missing HOT 1
- messageImageView typo in step 7 HOT 5
- Why my getDownloadUrl() has error ? HOT 5
- AuthUI.getInstance().signOut() missing 'this' HOT 1
- LinearLayoutManager tends to crash when new image inserted HOT 3
- USB Debugging
- Sign in with email: NEXT button does not work HOT 1
- Don't have gradle version 8.0.2
- Can't copy mock-google-services.json file to build-android-start/app folder
- Kepp getting error code 10 when logging with Google account
- MainActivity crash because of 'the default_web_client_id string wasn't populated' HOT 1
- com.firebaseui:firebase-ui-auth needs an upgrade HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codelab-friendlychat-android.