Reputation: 2290
I am building a detached android app using react native after installing a react-native-fcm I am always getting this error message:
my project gradle look as below:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// Point to local maven repository
url "$rootDir/../.expo-source/android/maven"
}
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
While my app/build.gradle looks as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "fi.x.y"
minSdkVersion 19
targetSdkVersion 26
versionCode 2
versionName "1.0.2"
multiDexEnabled true
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
manifestPlaceholders = [
'appAuthRedirectScheme': 'fi.x.y'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "8g"
}
lintOptions {
abortOnError false
}
}
task exponentPrebuildStep(type: Exec) {
workingDir '../../'
if (System.getProperty('os.name').toLowerCase().contains('windows')) {
commandLine 'cmd', '/c', '.\\.expo-source\\android\\detach-scripts\\prepare-detached-build.bat'
} else {
commandLine './.expo-source/android/detach-scripts/prepare-detached-build.sh'
}
}
preBuild.dependsOn exponentPrebuildStep
repositories{
flatDir{
dirs "../../node_modules/react-native-background-geolocation/android/libs"
}
mavenLocal()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
compile(project(':react-native-firebase')) {
transitive = false
}
compile project(':react-native-vector-icons')
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.2'
compile 'com.google.android.gms:play-services:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.google.android.gms:play-services-places:11.8.0'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.android.gms:play-services-ads:11.8.0'
compile('host.exp.exponent:expoview:22.0.0@aar') {
exclude group: 'com.facebook.android', module: 'facebook-android-sdk'
exclude group: 'com.facebook.android', module: 'audience-network-sdk'
exclude group: 'io.nlopez.smartlocation', module: 'library'
transitive = true
}
compile ('com.facebook.android:facebook-android-sdk:4.+')
compile('com.facebook.android:audience-network-sdk:4.+') {
exclude module: 'play-services-ads'
}
compile('io.nlopez.smartlocation:library:3.2.11') {
transitive = false
}
compile(project(':react-native-background-geolocation')) {
exclude group: 'com.google.android.gms', module: 'play-services-location'
}
compile(name: 'tslocationmanager', ext: 'aar') {
exclude group: 'com.google.android.gms'
}
compile project(':react-native-fcm')
compile 'com.google.firebase:firebase-core:11.8.0' //this decides your firebase SDK version
}
apply plugin: 'com.google.gms.google-services'
Main Application:
// Needed for `react-native link`
public List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
// Add your own packages here!
// TODO: add cool native modules
new RNBackgroundGeolocation(),
// Needed for `react-native link`
// new MainReactPackage(),
new RNFirebasePackage(),
new VectorIconsPackage(),
new RNFirebaseMessagingPackage(),
new FIRMessagingPackage()
);
}
And I am following this link to install push notification for react native android: https://github.com/evollu/react-native-fcm
I dont see any log coming into the console log, the project is building successfully saying but when it comes to launch the app the white screen with the error message comes Package is not running at xxx:yy.
I didnt have this problem before, I also had to change all the google service packages to 11.8.0 as there were conflicts when I installed the fcm library!
Any idea what would it cause so that I am unable to open my app!
Upvotes: 0
Views: 2161
Reputation:
I have had this issue before, try this:
Open your React Native app on your device. You'll see a red screen with an errorOpen the in-app Developer menu.(the one you are speaking about)
Go to Dev Settings → Debug server host for device. (Shake the device)
Type in your machine's IP address and the port of the local dev server (e.g. 10.0.1.1:8081). Go back to the Developer menu and select Reload JS.
I used ipconfig to find my IP and used the above method.
I'd also suggest go to your platform tools and ensure you have the adb installed correctly.
I actually figured out it was this, by creating a fresh react native project and found out that this solved the error.
Note: You may get another error telling you that x file path was not able to be deleted. I tried it out in my practice project and it worked. * Try at your own risk.
Upvotes: 1