Firebase Admin SDK for Android, methods not found
You can't use the Firebase Admin SDK in an Android app alongside the Firebase Android client libraries. The SDKs both provide classes with the exact same package and class name, so it wouldn't possibly be able to use them both at the same time (how would the compiler know which one you intend to build into your app?).
As an example, take a look at the javadoc for FirebaseOptions Builder in the Android client library:
com.google.firebase.FirebaseOptions.Builder
Now look at the same class from the java Admin SDK (note the URL is different):
com.google.firebase.FirebaseOptions.Builder
You can see for yourself that they're different things, even though they have the same name. Your compiler is therefore looking at the Android SDK definition and not the admin SDK definition.
As Frank said, you probably don't want to use the Admin library within your Android app. If you want to use the admin SDK, use it from a server you control, and have your Android app communicate with that if needed.
Add Firebase auth and Firebase admin in same Android Project
The Firebase Admin SDK is not intended for use in Android apps. It's for backend code running in a controlled server or desktop that you fully control. Please don't try work around this - instead your Android app should be invoking a backend that uses the Admin SDK to perform the work you need. It would be a fairly massive security hole for an app to have the Admin SDK and a service account bundled into it, as that leaves your project open to direct, easy abuse by anyone who can download your app and get the service account credentials.
How to solve Firebase Admin SDK dependencies incompatibility?
Let me ask you, why do you need firebase-admin? What are you trying to acomplish?
You should not add firebase-admin to your android app, as this lib is meant to be used only on trusted sources (that is, on code that runs securely behind a server). If you added firebase-admin to your app, you would be giving admin privileges for any user using the app, and this would be a security liability for your application.
Check this answer for more information.
Firebase admin sdk with java doesn't connect
The following code worked for me:
try {
FirebaseOptions options = new FirebaseOptions.Builder()
.setCredentials(GoogleCredentials
.fromStream(new ClassPathResource("/firebase-authentication.json").getInputStream()))
.build();
if (FirebaseApp.getApps().isEmpty()) {
FirebaseApp.initializeApp(options);
}
} catch (IOException e) {
e.printStackTrace();
}
The "/firebase-authentication.json" is in the resources folder.
Related Topics
Pass Arraylist<? Implements Parcelable> to Activity
How to Handle Outofmemoryerror
How to Handle Ontouch Event for Map in Google Map API V2
How to Get App's Permission for Each App? How to Do It Programmatically on Android
What's the Difference Between Setwebviewclient VS. Setwebchromeclient
Fragments Destroyed/Recreated with Jetpack's Android Navigation Components
Cannot Install Signed APK to Device Manually, Got Error "App Not Installed"
How to Add the Aidl File to Android Studio (From the In-App Billing Example)
Http Connection Timeout on Android Not Working
Intent - If Activity Is Running, Bring It to Front, Else Start a New One (From Notification)
How to Use Android Progressbar in Determinate Mode
Detect Power Button Long Press
Get Application Context Returns Null
Copy Database from Assets to Databases Folder
How to Make a Actionbar Like Google Play That Fades in When Scrolling
What Do Gc_For_Malloc, Gc_Explicit, and Other Gc_* Mean in Android Logcat
Does Broadcastreceiver.Onreceive Always Run in the UI Thread