My app crashes on first launch and works normally aftwerwards, ive tried using adb logcat to see what errors are logging but it shows nothinh. This happens when i to integrate firebase cloud messaging.
android/build.gradle
`
buildscript {
ext {
buildToolsVersion = "28.0.0"
minSdkVersion = 19
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
// googlePlayServicesVersion = "11.8.0"
googlePlayServicesVersion = "16.+"
firebaseVersion = "17.3.4"
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
mavenLocal()
google()
jcenter()
maven {
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
}
}
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (!details.requested.name.contains('multidex')) {
if (details.requested.group == 'com.android.support') {
details.useVersion "27.0.0"
}
if (details.requested.group == 'com.squareup.okhttp3') {
details.useVersion "3.12.1"
}
if (details.requested.group == 'com.squareup.okio') {
details.useVersion "1.15.0"
}
}
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}}`
android/app/build.gradle
`
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
entryFile: "index.js"
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
android {
compileSdkVersion 28
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.quickcredit.android"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
missingDimensionStrategy 'react-native-camera', 'general'
}
signingConfigs {
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation project(':react-native-locale')
implementation project(':react-native-get-sms-android')
implementation project(':react-native-call-log')
implementation project(':react-native-paystack')
implementation project(':react-native-config')
implementation project(':react-native-camera')
implementation project(':@react-native-community_async-storage')
implementation project(':react-native-gesture-handler')
implementation project(':react-native-camera')
implementation project(':react-native-vector-icons')
implementation project(':rn-fetch-blob')
implementation project(':react-native-file-picker')
implementation project(':react-native-linear-gradient')
implementation project(':react-native-splash-screen')
implementation fileTree(dir: "libs", include: ["*.jar"])
'com.android.support:appcompat-v7:27.1.0'
implementation "com.facebook.react:react-native:+" // From node_modules
implementation project(':react-native-firebase')
implementation 'com.android.support:multidex:1.0.3'
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.9"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true`
AndroidManifest.xml
xmlns:tools="http://schemas.android.com/tools">
<permission
android:name="android.permission.ACCESS_COARSE_LOCATION"
android:protectionLevel="signature" />
<permission
android:name="android.permission.ACCESS_FINE_LOCATION"
android:protectionLevel="signature"/>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
<service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
</application>
`
Same on my side. It happens to me with react-native 0.60.3. This line is what makes the app crashing:
implementation 'com.google.firebase:firebase-messaging:17.3.4'
If I remove it, my app doesn't crash anymore (but I don't have messaging anymore obviously).
Same here. This configuration was working for quite some time already, but now it crashes.
My deps:
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation "com.google.firebase:firebase-messaging:17.4.0"
implementation "com.google.firebase:firebase-config:17.0.0"
Seems like https://github.com/invertase/react-native-firebase/issues/1420 again but for slightly newer environment react-native-firebase 5.2.2 here.
Same here...
Unable to instantiate service io.invertase.firebase.messaging.RNFirebaseInstanceIdService
Dependencies:
implementation "com.google.firebase:firebase-core:16.0.8"
implementation "com.google.firebase:firebase-messaging:17.5.0"
I have the same problem
I found that uncomment these code below on AndroidManifest.xml solve my problem
<service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
Seems like it doesn't fully support autolinking yet. with react native 0.60.4 what works for me is to link it like this in MainApplication.java:
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.links.RNFirebaseLinksPackage;
import io.invertase.firebase.config.RNFirebaseRemoteConfigPackage;
import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
....
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for
// example:
packages.add(new RNFirebaseMessagingPackage());
packages.add(new RNFirebaseLinksPackage());
packages.add(new RNFirebaseRemoteConfigPackage());
packages.add(new RNFirebaseNotificationsPackage());
return packages;
}
in build.gradle:
dependencies {
// This should be here already
implementation project(':react-native-firebase')
// Firebase dependencies
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.google.firebase:firebase-config:17.0.0"
implementation "com.google.firebase:firebase-invites:17.0.0"
implementation "com.google.firebase:firebase-messaging:18.0.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
Hello 馃憢, to help manage issues we automatically close stale issues.
This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?
This issue will be closed in 15 days if no further activity occurs.
Thank you for your contributions.
Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.
Most helpful comment
Seems like it doesn't fully support autolinking yet. with react native 0.60.4 what works for me is to link it like this in MainApplication.java:
in build.gradle: