Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java.lang.NoClassDefFoundError: com.google.android.gms.nearby.messages.Message #19

Open
butchmarshall opened this issue Jan 9, 2018 · 5 comments

Comments

@butchmarshall
Copy link

butchmarshall commented Jan 9, 2018

Tried to use the module but doesn't seem to work with my config.

Any ideas?

MainApplication.java:


import com.facebook.react.ReactApplication;
import com.badfeatures.nearby.RNNearbyApiPackage;
import fr.bamlab.rnimageresizer.ImageResizerPackage;
import com.imagepicker.ImagePickerPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.messaging.RNFirebaseMessagingPackage;
import io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;
//import io.invertase.firebase.admob.RNFirebaseAdMobPackage;
import com.mapbox.rctmgl.RCTMGLPackage;
import org.devio.rn.splashscreen.SplashScreenReactPackage;
import com.idehub.Billing.InAppBillingBridgePackage;
import com.react.rnspinkit.RNSpinkitPackage;
import com.RNFetchBlob.RNFetchBlobPackage;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.rnfs.RNFSPackage;
import com.rnziparchive.RNZipArchivePackage;
import com.tradle.react.UdpSocketsModule;
import com.peel.react.TcpSocketsModule;
import com.bitgo.randombytes.RandomBytesPackage;
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.corbt.keepawake.KCKeepAwakePackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;
import com.wix.interactable.Interactable;

import com.facebook.react.modules.network.ReactCookieJarContainer;
import com.facebook.stetho.Stetho;
import okhttp3.OkHttpClient;
import com.facebook.react.modules.network.OkHttpClientProvider;
import com.facebook.stetho.okhttp3.StethoInterceptor;
import java.util.concurrent.TimeUnit;

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 RNNearbyApiPackage(),
            new ImageResizerPackage(),
            new ImagePickerPackage(),
            new RNFirebasePackage(),
            new RNFirebaseMessagingPackage(),
            new RNFirebaseAnalyticsPackage(),
            //new RNFirebaseAdMobPackage(),
            new RCTMGLPackage(),
            new SplashScreenReactPackage(),
            new InAppBillingBridgePackage(),
            new RNSpinkitPackage(),
            new RNFetchBlobPackage(),
            new RNDeviceInfo(),
            new RNFSPackage(),
            new RNZipArchivePackage(),
            new UdpSocketsModule(),
            new TcpSocketsModule(),
            new RandomBytesPackage(),
            new ReactNativeConfigPackage(),
            new VectorIconsPackage(),
            new KCKeepAwakePackage(),
            new Interactable()
      );
    }
  };

settings.gradle:

include ':react-native-nearby-api'
project(':react-native-nearby-api').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-nearby-api/android')

android/app/build.gradle:


dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile 'com.android.support:multidex:1.0.1'
    compile project(':react-native-nearby-api')
    compile project(':react-native-image-resizer')
    compile project(':react-native-image-picker')
    compile(project(':react-native-firebase')) {
        transitive = false
    }
	compile "com.google.firebase:firebase-core:11.6.0"
	compile "com.google.firebase:firebase-messaging:11.6.0"
	compile "com.google.firebase:firebase-analytics:11.6.0"
	//compile "com.google.firebase:firebase-ads:11.6.0"

    compile project(':mapbox-react-native-mapbox-gl')
    compile project(path: ':react-native-interactable')
    compile project(':react-native-splash-screen')
    compile project(':react-native-billing')
    compile 'com.facebook.stetho:stetho:1.3.1'
    compile 'com.facebook.stetho:stetho-okhttp3:1.3.1'

    compile project(':react-native-spinkit')
    compile project(':react-native-fetch-blob')
    compile (project(':react-native-device-info')) {
        exclude group: "com.google.android.gms" 
    }
    compile project(':react-native-fs')
    compile project(':react-native-zip-archive')
    compile project(':react-native-udp')
    compile project(':react-native-tcp')
    compile project(':react-native-randombytes')
    compile project(':react-native-config')
    compile project(':react-native-vector-icons')
    compile project(':react-native-keep-awake')
    compile "com.android.support:appcompat-v7:23.0.1"
    compile "com.facebook.react:react-native:0.51.0"  // From node_modules
	
	// Firebase dependencies
	compile ("com.google.android.gms:play-services-gcm:11.6.0") {
        force = true;
    }
	compile ("com.google.android.gms:play-services-base:11.6.0") {
		force = true;
	}
}
@migbot
Copy link

migbot commented Apr 12, 2018

@butchmarshall Did you get this resolved?

@jortegano
Copy link

jortegano commented Aug 20, 2018

Hi guys, Does anyone has any idea on how to solve this?.

I have the exact same error and I believe is due to some kind of conflict with other google libraries. This started to happen in my project when I added react-native-push-notification plugin, also happened when I added urbanairship's RN plugin.

@rares-lupascu
Copy link

same here :(

@rares-lupascu
Copy link

unfortunately i think this repo is dead since there is no reply from anyone for a few months now

@joshbalfour
Copy link

I was able to fix this by changing my app/build.gradle to exclude the com.google.android.gms group from react-native-nearby-api and force update it to com.google.android.gms:play-services-nearby:15.0.0

hope this helps!

dependencies {
    compile project(':react-native-splash-screen')
    compile project(':react-native-sound')
    compile (project(':react-native-nearby-api')){
        exclude group: "com.google.android.gms"
    }
    compile project(':react-native-keep-awake')
    compile project(':react-native-haptic-feedback')
    compile project(':react-native-google-analytics-bridge')
    compile project(':lottie-react-native')

    compile project(':appcenter-crashes')
    compile project(':appcenter-analytics')
    compile project(':appcenter')

    compile project(':react-native-code-push')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:23.0.1"

    compile "com.facebook.react:react-native:+"  // From node_modules

    compile ("com.google.android.gms:play-services-nearby:15.0.0") {
        force = true
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants