Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest #18

Closed
alexanderlamb opened this issue Jan 14, 2017 · 15 comments
Closed
Labels

Comments

@alexanderlamb
Copy link

I'm running react-native v0.40.0 with tipsi-stripe 1.4.0 and can't get around the following error

adb logout output:
I/art (25295): Rejecting re-init on previously-failed class java.lang.Class<com.google.android.gms.wallet.MaskedWalletRequest> E/ReactNativeJS(25295): C++ Exception in 'NativeModules': java.lang.NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest

I've cleared my gradle cache, tried to install all related dependancies but have been unsuccessful.

Has anyone hit this before?

@fAns1k
Copy link
Contributor

fAns1k commented Jan 16, 2017

Hi @alexanderlamb ! Thanks for your comment. I was trying to reproduce this bug, but i couldn’t. Could you please explain, how are you getting this error? What device or emulator are you using, android api, version?

@alexanderlamb
Copy link
Author

Hi @fAns1k! I'm seeing this error on an Asus ZenPad running Android 5.0.2 (API 21).

Installation was done using react-native link tipsi-stripe

I'm implementing tipsi-stripe like this:

'use strict';

import Relay from 'react-relay';
import React, { Component, PropTypes } from 'react';
import {
  Platform,
  StyleSheet,
  Text,
  View,
  ScrollView,
  TouchableOpacity,
  Animated,
  ListView,
  ActivityIndicator
} from 'react-native';
...
import Config from '../config'
import stripe from 'tipsi-stripe';

stripe.init({
  publishableKey: Config.stripePublicKey
})

class CompletePurchaseModal extends Component {...}

@alexanderlamb
Copy link
Author

also during thereact-native link tipsi-stripe process I get this response:

Preparing to link tipsi-stripe for iOS
Checking CocoaPods...
CocoaPods already installed
rnpm-install info Linking tipsi-stripe android dependency 
rnpm-install info Android module tipsi-stripe has been successfully linked 
rnpm-install info Linking tipsi-stripe ios dependency 
rnpm-install info iOS module tipsi-stripe has been successfully linked 
Checking Podfile in iOS project (/Users/XXXXX/Documents/Dropbox/XXXXXX/ios/Podfile)
Found an existing Podfile
Installing Pods
Analyzing dependencies
[!] The dependency `Stripe (~> 9.2.0)` is not used in any concrete target.

Not sure if the [!] The dependency Stripe (~> 9.2.0) is not used in any concrete target. could have an impact on the android build.

@fAns1k
Copy link
Contributor

fAns1k commented Jan 17, 2017

Hello @alexanderlamb! I still can't reproduce this bug. Could you complete the following steps to exclude some of the reasons. I have an assumption that it is related to the older version of the GooglePlayServices on your device.
Could you, please, try to do the following:

  • update GooglePlayServices on your device to the last version and run the app again.
  • Run the app on another device and check if the error could be reproduced.
  • Run the app on the AVD emulator, like nexus 5, with the latest version of GooglePlayServices.
    If this does not help, could you, please, share a link to your repo, where you getting this bug?

@fabriziomoscon
Copy link

I have the same issues, my app compiles, but it crashes immediately after booting:
react-native 0.38.0
Google Nexus 5 - genymotion
Google Play services 10.0.84

logs

UncaughtException: java.lang.NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest
      at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
      at java.lang.Class.getDexCacheType(Class.java:476)
      at java.lang.reflect.Method.getReturnType(Method.java:183)
      at java.lang.Class.getDeclaredMethods(Class.java:672)
      at com.facebook.react.bridge.BaseJavaModule.findMethods(BaseJavaModule.java:404)
      at com.facebook.react.bridge.BaseJavaModule.getMethods(BaseJavaModule.java:433)
      at com.facebook.react.cxxbridge.JavaModuleWrapper.getMethodDescriptors(JavaModuleWrapper.java:76)
      at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
      at android.os.Handler.handleCallback(Handler.java:739)
      at android.os.Handler.dispatchMessage(Handler.java:95)
      at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
      at android.os.Looper.loop(Looper.java:148)
      at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
      at java.lang.Thread.run(Thread.java:818)
   Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.wallet.MaskedWalletRequest" on path: DexPathList[[zip file "/data/app/<MY_APP>.DEV.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/<MY_APP>.DEV.debug-1/lib/x86, /data/app/<MY_APP>.DEV.debug-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
      at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
      at java.lang.Class.getDexCacheType(Class.java:476) 
      at java.lang.reflect.Method.getReturnType(Method.java:183) 
      at java.lang.Class.getDeclaredMethods(Class.java:672) 
      at com.facebook.react.bridge.BaseJavaModule.findMethods(BaseJavaModule.java:404) 
      at com.facebook.react.bridge.BaseJavaModule.getMethods(BaseJavaModule.java:433) 
      at com.facebook.react.cxxbridge.JavaModuleWrapper.getMethodDescriptors(JavaModuleWrapper.java:76) 
      at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
      at android.os.Handler.handleCallback(Handler.java:739) 
      at android.os.Handler.dispatchMessage(Handler.java:95) 
      at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
      at android.os.Looper.loop(Looper.java:148) 
      at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
      at java.lang.Thread.run(Thread.java:818) 
    Suppressed: java.lang.NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest
      at dalvik.system.DexFile.defineClassNative(Native Method)
      at dalvik.system.DexFile.defineClass(DexFile.java:226)
      at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
      at dalvik.system.DexPathList.findClass(DexPathList.java:338)
      at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
            ... 16 more
    Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.wallet.MaskedWalletRequest
      at java.lang.Class.classForName(Native Method)
      at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
      at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 15 more
   Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
01-20 15:19:48.569 2847-2872/<MY_APP>.DEV.debug I/FA: Tag Manager is not found and thus will not be used
01-20 15:19:48.781 2847-2906/<MY_APP>.DEV.debug E/AndroidRuntime: FATAL EXCEPTION: mqt_js
   Process: <MY_APP>.DEV.debug, PID: 2847
   java.lang.NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest
       at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
       at java.lang.Class.getDexCacheType(Class.java:476)
       at java.lang.reflect.Method.getReturnType(Method.java:183)
       at java.lang.Class.getDeclaredMethods(Class.java:672)
       at com.facebook.react.bridge.BaseJavaModule.findMethods(BaseJavaModule.java:404)
       at com.facebook.react.bridge.BaseJavaModule.getMethods(BaseJavaModule.java:433)
       at com.facebook.react.cxxbridge.JavaModuleWrapper.getMethodDescriptors(JavaModuleWrapper.java:76)
       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
       at android.os.Looper.loop(Looper.java:148)
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
       at java.lang.Thread.run(Thread.java:818)
    Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.wallet.MaskedWalletRequest" on path: DexPathList[[zip file "/data/app/<MY_APP>.DEV.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/<MY_APP>.DEV.debug-1/lib/x86, /data/app/<MY_APP>.DEV.debug-1/base.apk!/lib/x86, /vendor/lib, /system/lib]]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
       at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
       at java.lang.Class.getDexCacheType(Class.java:476) 
       at java.lang.reflect.Method.getReturnType(Method.java:183) 
       at java.lang.Class.getDeclaredMethods(Class.java:672) 
       at com.facebook.react.bridge.BaseJavaModule.findMethods(BaseJavaModule.java:404) 
       at com.facebook.react.bridge.BaseJavaModule.getMethods(BaseJavaModule.java:433) 
       at com.facebook.react.cxxbridge.JavaModuleWrapper.getMethodDescriptors(JavaModuleWrapper.java:76) 
       at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
       at android.os.Handler.handleCallback(Handler.java:739) 
       at android.os.Handler.dispatchMessage(Handler.java:95) 
       at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
       at android.os.Looper.loop(Looper.java:148) 
       at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
       at java.lang.Thread.run(Thread.java:818) 
    Suppressed: java.lang.NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest
       at dalvik.system.DexFile.defineClassNative(Native Method)
       at dalvik.system.DexFile.defineClass(DexFile.java:226)
       at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
       at dalvik.system.DexPathList.findClass(DexPathList.java:338)
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
            ... 16 more
    Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.wallet.MaskedWalletRequest
       at java.lang.Class.classForName(Native Method)
       at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
       at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
            ... 15 more
    Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available

my android/app/build.gradle dependencies

dependencies {
    compile project(':tipsi-stripe')
    compile project(':react-native-awesome-card-io')
    compile project(':react-native-fcm')
    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-gcm:10.0.1') {
        force = true;
    }
    compile 'com.google.firebase:firebase-crash:10.0.1'
}

...
// Firebase integration
apply plugin: 'com.google.gms.google-services'

SOLUTION

I had to add in my android/app/build.gradle dependencies list

compile 'com.google.android.gms:play-services-wallet:10.0.1'

@alexanderlamb
Copy link
Author

@fabriziomoscon That solution worked for me as well 👍

@fAns1k
Copy link
Contributor

fAns1k commented Jan 23, 2017

Hi @fabriziomoscon! Thank you for comment. We try fix this bug without additional dependences but we still cant reproduce it.
I try reproduce bug with your conditions: react-native 0.38.0 Google Nexus 5 - genymotion Google Play services 10.0.84 , but still not get bug.
Do you have Android Pay app on your emulator? If you have, which version of it?

@fabriziomoscon
Copy link

Hi @fAns1k,
Actually, I haven't setup Android Pay at all.
Could this error occur because play-services-* between App and lib are conflicting? I have this in my android/app/build.gradle file

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

@fAns1k
Copy link
Contributor

fAns1k commented Jan 23, 2017

@fabriziomoscon thank you! I've added these lines to my app gradle dependence and got the same error.

@fAns1k
Copy link
Contributor

fAns1k commented Jan 23, 2017

@fabriziomoscon @alexanderlamb I have done some fixes. Could you please check it out - npm i --save tipsi/tipsi-stripe#issue_18 , without your fixes ( compile 'com.google.android.gms:play-services-wallet:10.0.1' ) , and let me please know it works for you or not?

@fabriziomoscon
Copy link

@fAns1k it seems working.

@fAns1k fAns1k mentioned this issue Jan 23, 2017
cybergrind pushed a commit that referenced this issue Jan 27, 2017
* - init gradle demon

* - upgrade play services version to 10.0.1

* - change play services version to 10.+

* - remove gradle demon

* - add Troubleshooting section to readme , with info about thiis issue

* - correcting readme
@tonyhb
Copy link

tonyhb commented Oct 12, 2017

This is re-occuring now that certain projects use "com.android.support:appcompat-v7:26.0.1".

@ghost
Copy link

ghost commented Nov 22, 2017

Thanks @fabriziomoscon you have been the final piece to my frustrating journey trying to implement Mapbox, please see https://stackoverflow.com/questions/47213691/react-native-map-box-execution-failed-transform-classes-with-dex-jarmerging and nitaliano/react-native-mapbox-gl#785

🥇

@panda8z
Copy link

panda8z commented May 30, 2018

image
this is re-occuring now that in tipsi-stripe 3.7.1

@isnifer
Copy link
Contributor

isnifer commented May 30, 2018

@panda8z upgrade your deps, upgrade tipsi-stripe :)

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

No branches or pull requests

7 participants