JeanLebrument / react-native-fabric-digits

Fabric Digits wrapper for React-Native
109 stars 51 forks source link

could not invoke digitsmanager.launchauthentication #34

Open jcharbo opened 8 years ago

jcharbo commented 8 years ago

Hi, I'm using the latest react-native-fabric-digits with react native .31. It works great on IOS but it's crashing on android. I've followed all of the installation docs repeatedly and cannot solve it. The emulator error I get is "could not invoke digitsmanager.launchauthentication". Android studio shows this:

08-23 17:35:59.739 6321-6754/com.thejump E/unknown:React: Exception in native call from JS java.lang.RuntimeException: Could not invoke DigitsManager.launchAuthentication at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:332) at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:139) 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.reflect.InvocationTargetException at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:319) at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:139)  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.NoClassDefFoundError: Failed resolution of: Lcom/digits/sdk/android/DigitsAuthConfig$Builder; at com.proxima.RCTDigits.DigitsManager.launchAuthentication(DigitsManager.java:71) at java.lang.reflect.Method.invoke(Native Method)  at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:319)  at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:139)  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.digits.sdk.android.DigitsAuthConfig$Builder" on path: DexPathList[[dex file "/data/data/com.thejump/files/instant-run/dex/slice-support-annotations-23.3.0_3681a8e99e5a9a555c1e885cb5b9edb24ea66b75-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_9-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_8-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_7-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_6-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_5-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_4-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_3-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_2-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_1-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-slice_0-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-retrofit-mock-2.0.2_c3f2a6c7ffef5e1b4ad0b3b9bf83aff01fca3fea-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-retrofit-2.0.2_a02b98610d602b1130e7f010214dc1cbf14adf32-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-okio-1.9.0_4b0d89b3c968c5450341b2330eb3c1aecc812cc0-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-okhttp-ws-3.4.1_5f1e6dd4785eda38c1ffd1cb90602d013f90079f-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-okhttp-urlconnection-3.4.1_26bef851f10160960421d1a1a2551fa514f3f12c-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-okhttp-3.4.1_17390d9991ea95a979457c10502ff2139d9fbe68-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-library-2.4.0_53da2934dc05d965fbe5388a792416c0686f06de-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-jsr305-3.0.0_a927c9dba608f0aaf26cd01b0deccfc7887a34ee-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-jackson-core-2.2.3_1273d14ef5f4566a82d137d9dc36e6985a7e3605-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-io.fabric.sdk.android-fabric-1.3.13_b3f7b24059e88ad34ce0f97b55df098e12467e88-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-internal_impl-23.3.0_fd48f3805a2504473e6930350ae89656c76ccb08-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-infer-annotations-1.5_e77ebc21d8d665ddcc8b367707f3e8738d3ec621-classes.dex", dex file "/data/data/com.thejump/files/instant-run/dex/slice-gson-2.6.1_efa77e4d525d6b4e68c05c34c8ce607736f7300c-classes.dex", dex file "/data/data/c

Please help me figure this out. Could it have anything to do with the fact that my app is using digits 2.0.0 and react-native-fabric-digits is using 1.9.2? thanks Jeremey

jcharbo commented 8 years ago

Turns out it is a versioning issue. Is anyone still using this library? Why am I the only one having these issues?

JeanLebrument commented 8 years ago

Hello jcharbo, what do you mean by versioning issue?

Jean Lebrument

On Wed, Aug 24, 2016 at 8:28 PM jcharbo

< mailto:jcharbo notifications@github.com

wrote:

a, pre, code, a:link, body { word-wrap: break-word !important; }

Turns out it is a versioning issue. Is anyone still using this library? Why am I the only one having these issues?

You are receiving this because you are subscribed to this thread.

Reply to this email directly, https://github.com/JeanLebrument/react-native-fabric-digits/issues/34#issuecomment-242163628 , or https://github.com/notifications/unsubscribe-auth/AC9ndCst1YaJ1sX9QdJTFngdurpKC189ks5qjI0ygaJpZM4JrawV .

cinkster commented 8 years ago

I had this same problem. I think what @jcharbo meant was the problem was directly related to the fact this plugin expects digits 1.9.2 and the current fabric digits installation instructions ask for digits 2.0.0 to be added to android/app/build.gradle

I solved this by just including

compile('com.digits.sdk.android:digits:1.9.2@aar') { transitive = true; }

instead of

compile('com.digits.sdk.android:digits:2.0.0@aar') { transitive = true; }

I then ran cd android ./gradlew clean

and everything worked as expected.

jcharbo commented 8 years ago

Thanks cinkster, that's exactly what I meant. I also had to change the code that you are supposed to add in the fabric digits installation walkthrough. They tell you to put this: Fabric.with(this, new TwitterCore(authConfig), new Digits.Builder().build()); but I had to change it to this: Fabric.with(this, new TwitterCore(authConfig), new Digits());

pewh commented 7 years ago

I'm still get same issue although I've added compile('com.digits.sdk.android:digits:2.0.0@aar') { transitive = true; } and ./gradlew clean

Tested on RN 0.34 with latest react-native-fabric-digits@1.0.19.

MainAcitivity:

public class MainActivity extends ReactActivity {
    @Override
    protected String getMainComponentName() {
        return "asd";
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.initializeDigits();
    }

    // from react-native-fabric-digits
    private void initializeDigits() {
      String TWITTER_KEY = "...";
      String TWITTER_SECRET = "...";

      TwitterAuthConfig authConfig = new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET);
      TwitterCore twitterConfig = new TwitterCore(authConfig);
      Fabric.with(this, twitterConfig, new Digits.Builder().build());
    }
}

android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: "io.fabric"

import com.android.build.OutputFile

...

dependencies {
    compile project(':react-native-fabric-digits')
    ...
    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.digits.sdk.android:digits:2.0.0@aar') {
        transitive = true;
    }
}

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.google.gms:google-services:3.0.0'
        classpath 'io.fabric.tools:gradle:1.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
}
ivankennethwang commented 7 years ago

@JeanLebrument Any idea if the pull request will be merged to master? Why was it closed but wasn't merged?

JeanLebrument commented 7 years ago

The PR has been closed by the contributor. Don't know why!

ivankennethwang commented 7 years ago

Can we at least have those changes in? hehe. Thanks!

JeanLebrument commented 7 years ago

Done @ivankennethwang