react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Cannot find symbol new ReactNativePushNotificationPackage

Open PinkPanda17 opened this issue 8 years ago • 11 comments

So I was just setting up the project but always have an error regarding the ReactNativePushNotificationPackage .

I am using:

"react-native-push-notification": "^3.0.2", "react": "16.3.0-alpha.1", "react-native": "0.54.2",

it says package com.dieam.reactnativepushnotification does not exist

thus resulting for : cannot find symbol new ReactNativePushNotificationPackage(),

Here is the code:

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.dieam.reactnativepushnotification.ReactNativePushNotificationPackage;
import com.reactnativedocumentpicker.ReactNativeDocumentPicker;
import org.wonday.pdf.RCTPdfView;
import com.arttitude360.reactnative.rngoogleplaces.RNGooglePlacesPackage;
import io.realm.react.RealmReactPackage;
import com.airbnb.android.react.maps.MapsPackage;

import com.BV.LinearGradient.LinearGradientPackage;
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.imagepicker.ImagePickerPackage; // <-- add this import
import com.RNFetchBlob.RNFetchBlobPackage;      
import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
            new ReactNativePushNotificationPackage(),
            new ReactNativeDocumentPicker(),
            new RCTPdfView(),
            new RNGooglePlacesPackage(),
          new RNFetchBlobPackage() ,
            new RealmReactPackage(),
            new MapsPackage(),
           new ImagePickerPackage(),
            new LinearGradientPackage(),
            new ReactNativeConfigPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}

PinkPanda17 avatar Apr 27 '18 03:04 PinkPanda17

Update: I added: compile project(':react-native-push-notification') on build.gradle , now the app is crashing ... I tried almost everything. I followed the documentation carefully Still the same problem. Any Thoughts about this?

PinkPanda17 avatar Apr 27 '18 05:04 PinkPanda17

I had the same problem, try to remove everything that you added in the bundle..etc. And try installing again following this instruction

ManFromSiberia avatar Apr 27 '18 14:04 ManFromSiberia

I fixed it , apparently I have a library that uses a different version of Google play services , so I just forced the library to use the same Google Play Services . That fixed the problem.

PinkPanda17 avatar Apr 30 '18 08:04 PinkPanda17

@PinkPanda17 just ran into the same problem. Can you explain how you fixed it?

macrozone avatar Apr 30 '18 16:04 macrozone

I'm also running into the same issue, and I haven't managed to fix it. Does anyone have an example on how to get it working?

miolfo avatar Jun 21 '18 11:06 miolfo

Guys here is the solution (btw, rather often fix in RN applications): android/app/build.gradle here we should explicitly set play-services-base version for a package:


dependencies {
    compile project(':realm')
    compile project(':react-native-streetview')
    // For animated GIF support
    compile 'com.facebook.fresco:animated-gif:1.3.0'
    compile(project(':react-native-geolocation-service')) {
        exclude group: 'com.google.android.gms', module: 'play-services-location'
    }

    compile(project(':react-native-navigation')) {
        exclude group: 'com.google.android.gms', module: 'play-services-location'
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

    // compile project(':react-native-navigation')

    compile ('com.google.android.gms:play-services-location:11.0.4'){
        force = true;
    }

    compile project(':react-native-vector-icons')
    // ADD THIS LINES
    compile(project(':react-native-push-notification')){
       exclude group: 'com.google.android.gms', module: 'play-services-base'
    }

    compile(project(':react-native-maps')){
       exclude group: 'com.google.android.gms', module: 'play-services-base'
       exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

    // ADD THIS LINE (all packages should use the same google-play-service version)
    compile 'com.google.android.gms:play-services-base:11.0.4' // <----
    compile 'com.google.android.gms:play-services-maps:11.0.4'

    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:+"  // From node_modules

}

vitto-moz avatar Jun 21 '18 12:06 vitto-moz

by adding "implementation project(':react-native-push-notification')" build successful but app crashing react:16.2 react-native:0.52

ghost avatar Jul 16 '18 19:07 ghost

add "compile project(':react-native-push-notification')" in build.gradle, build successful! I need compile 3 times consecutive for successful, in administrator cmd!

ThiagoGodinhoPaschoalin avatar Sep 17 '18 13:09 ThiagoGodinhoPaschoalin

Adding the following to app/build.gradle under dependencies fixed it:

implementation project(":react-native-push-notification")

yashafromrussia avatar Jan 15 '19 03:01 yashafromrussia

Adding the following At android/build.gradle

ext {
   ...
   googlePlayServicesVersion = "12.0.1" // default: "+"
   firebaseVersion = "12.0.1" // default: "+"
}

At android/app/build.gradle

dependencies {
    ...
    implementation project(':react-native-push-notification')
}

Worked for me. Building and NOT crashing!

arthursoas avatar Jan 30 '19 14:01 arthursoas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 24 '20 00:05 github-actions[bot]