Tipsi-stripe: NoClassDefFoundError: com.google.android.gms.wallet.MaskedWalletRequest

Created on 14 Jan 2017  路  15Comments  路  Source: tipsi/tipsi-stripe

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?

bug

Most helpful comment

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'

All 15 comments

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

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 {...}

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 dependencyStripe (~> 9.2.0)is not used in any concrete target. could have an impact on the android build.

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?

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'

@fabriziomoscon That solution worked for me as well 馃憤

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?

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;
    }

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

@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?

@fAns1k it seems working.

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

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 https://github.com/mapbox/react-native-mapbox-gl/issues/785

馃

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

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

Was this page helpful?
0 / 5 - 0 ratings