I am trying to implement Firebase Cloud Messaging in my application, I had implemented all settings to use this service, but when I try to extend FirebaseMessagingService in my class it gives me error and it can't find it at all, I can't even import com.google.firebase.messaging.FirebaseMessagingService as shown in the picture:
I had added all the code required:
I added this to app gradle
compile 'com.google.firebase:firebase-core:9.4.0'
apply plugin: 'com.google.gms.google-services'
and this to the module gradle:
classpath 'com.google.gms:google-services:3.0.0'
this is the manifest code:
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<service
android:name=".MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
</application>
and I added the google json file to the app.
So if anybody can help me please
If you want to use messaging, you have to add the messaging module. Right now you only added the core module.
So go ahead and include
compile 'com.google.firebase:firebase-messaging:9.4.0'
All the available modules can be found at the bottom of https://firebase.google.com/docs/android/setup
Related
my problem is related to Android Studio.Whenever I try to run my app I get an error that says default activity not found.Please help me out,it's really important.Thank you in advance!
Just in case,I've got 2 classes: the first one is MainActivity,the second one is CatRepository
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.cats">
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Try to replace <activity android:name=".ui.MainActivity"> by <activity android:name=".MainActivity">
Try putting full package name of your Activity.
You can try invalidating cache and restart.
File -> Invalidate Cache/Restart
Also after doing this, sync your project. : File-> Sync Project with Gradle Files
I am trying to add the latest FirebaseUI dependency to my Android project. I have Facebook login enabled in my project, and when I set up the Facebook login I was required to add my Facebook App ID in the Android manifest. Here is the dependency I added to my android project:
"com.firebaseui:firebase-ui:3.0.0"
After compiling, I received the following error:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#com.facebook.sdk.ApplicationId#value value=() from AndroidManifest.xml:29:13-52
is also present at [com.firebaseui:firebase-ui-auth:3.0.0] AndroidManifest.xml:21:13-60 value=().
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:27:9-29:55 to override.
I am not sure why I am being prompted to change my Facebook App ID in order to use the latest library. I am updating so that I can take advantage of the new FirebaseUI features and Firebase Cloud Firestore as well.
Manifest
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="android.support.multidex.MultiDexApplication"
android:allowBackup="true"
android:icon="#drawable/xxxxxxx"
android:label="#string/xxxxxxx"
android:theme="#style/AppTheme.NoActionBar"> <!-- ADD THIS LINE -->
<activity
android:name=".SignupActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar"
tools:replace="android:theme" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="#string/facebook_app_id" />
<meta-data
android:name="com.firebase.ui.GoogleClientId"
android:value="#string/google_client_id" />
<meta-data
android:name="com.firebase.ui.TwitterKey"
android:value="#string/twitter_app_key" />
<meta-data
android:name="com.firebase.ui.TwitterSecret"
android:value="#string/twitter_app_secret" />
<activity
android:name=".PollHostActivity"
android:label="#string/title_activity_poll"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />
<activity
android:name=".LoadingActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".HomeActivity"
android:screenOrientation="portrait" />
<activity
android:name=".CreateActivity"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar" />
<activity
android:name=".NewImageActivity"
android:theme="#style/AppTheme">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data
android:name="android.app.searchable"
android:resource="#xml/searchable" />
</activity>
<activity
android:name=".ProfileActivity"
android:label="#string/title_activity_profile"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
Your post says: when I set up the Facebook login I was required to add my Facebook App ID in the Android manifest. That is not the case for firebase-ui-auth:3.1.0 and may not be for 3.0.0 either. With 3.1.0, you define the IDs as string resources, as described here, and FirebaseUI generates the needed manifest entries, which get merged into the main manifest at build time. If you are defining the constants in your manifest manually, that is likely the cause of the merge conflict.
To see the contributors to the merged manifest, open your AndroidManifest.xml file in Android Studio. Click the Merged Manifest tab at the bottom of the window. In the right pane, find and click on firebase-ui-auth:3.0.0 to see the manifest entries that are generated by FirebaseUI for merging into the composite manifest. If you see meta-data entries there that you have manually entered into your manifest, delete your entries to eliminate the merge conflict.
Try following their GitHub readme, located here. I was having the same problem as well and my question got a lot of attention but unluckily none could pin point the problem. The problem lies somewhere in the gradle file where you are writing this "com.firebaseui:firebase-ui:3.0.0".
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(25.3.0) from [com.android.support:design:25.3.0] AndroidManifest.xml:27:9-31
is also present at [com.android.support:support-v4:25.3.1] AndroidManifest.xml:27:9-31 value=(25.3.1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:34 to override.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.helploger.www.swipeview">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:fullBackupContent="false"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"
/>
</intent-filter>
</activity>
</application>
</manifest>
You are using multiple versions of the Android Support Libraries:
Move all your support libraries to one version 25.3.1 or 25.3.0
I was having an exact same error after moving all support libraries to 25.3.1 my error was removed.
If you guys get this error in Ionic / Ionic 3 / Cordova, check the below line in your project.properties file. Change the plus to your version.
cordova.system.library.7=com.android.support:support-v4:+
I have downloaded googlesamples: vulkan-basic-samples, compiled and executed this samples. Howevew ,I found all of this samples specified a NativeActivity in their AndroidManifest.xml, such as:
<!-- Our activity is the built-in NativeActivity framework class.
This will take care of integrating with our NDK code. -->
<activity android:name="android.app.NativeActivity"
android:label="#string/app_name"
android:configChanges="orientation|keyboardHidden">
<!-- Tell NativeActivity the name of or .so -->
<meta-data android:name="android.app.lib_name"
android:value="vulkan_samples" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
But I want to use my own Activity(in Java), please tell me How.
Thanks!
Im new to android, and when i read "Create New Activity" i was under the impression it creates a new "Window/Layout/Screen".
When i start making my own application i see
Main.java
is one application and
SecondActivity.java
is another app in my Emulators menu?
Why is that and how can i go about making one app with multiple windows as apposed to multiple applications essentially?
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ryan.bidorbuyapp" >
<application
android:allowBackup="true"
android:icon="#mipmap/bidorbuy_logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SearchResults"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/title_activity_search_results"
android:parentActivityName=".FullscreenActivity"
android:theme="#style/FullscreenTheme" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.ryan.bidorbuyapp.FullscreenActivity" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
thanks
Look at your AndroidManifest.xml there is the problem. Your activities have Launcher between it's tags. Only one activity must have LAUNCHER tag
Only one activity must have
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
You should understand what is an Activity before starting to developing an android application. You can think an activity as a page in web. There can be one or more and every activity includes their own contents.
When you create a new activity in your project, you should navigate by doing some operations in another activity. Intent helps you at this point to navigate one activity to the another.
Your problem is that, you should check your AndroidManifest.xml file. Please check the declaration of intent here. I think you will solve it after making a search about Intent.