Code Monkey home page Code Monkey logo

Comments (9)

hackrx avatar hackrx commented on July 24, 2024

Hey @abdougenesis are you able to solve this issue?

from samples.

mesibo avatar mesibo commented on July 24, 2024

Are you using latest API versions?

https://mesibo.com/documentation/install/android/

from samples.

hackrx avatar hackrx commented on July 24, 2024

@mesibo Yes, I am using the latest API version,

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

app/ build.gradle

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
        implementation 'com.mesibo.api:mesibo:1.2.30'
    //     implementation 'com.mesibo.api:ui:1.2.30'
    // implementation 'com.mesibo.api:calls:1.2.30'
    //     implementation 'com.mesibo.api:callui:1.2.30'

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

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    if (enableHermes) {
        def hermesPath = "../../node_modules/hermes-engine/android/";
        debugImplementation files(hermesPath + "hermes-debug.aar")
        releaseImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }
}

MainApplication.java

package com.mesibotest;

import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.mesibo.api.Mesibo;

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() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          // packages.add(new MyReactNativePackage());
          return packages;
        }

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

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

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

  /**
   * Loads Flipper in React Native templates. Call this in the onCreate method with something like
   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
   *
   * @param context
   * @param reactInstanceManager
   */
  private static void initializeFlipper(
      Context context, ReactInstanceManager reactInstanceManager) {
    if (BuildConfig.DEBUG) {
      try {
        /*
         We use reflection here to pick up the class that initializes Flipper,
        since Flipper library is not available in release mode
        */
        Class<?> aClass = Class.forName("com.mesibotest.ReactNativeFlipper");
        aClass
            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
            .invoke(null, context, reactInstanceManager);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (NoSuchMethodException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
}

package.json

"dependencies": {
    "react": "16.13.1",
    "react-native": "0.63.4"
  },

console-error

MesiboTest % yarn android
yarn run v1.22.10
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...

> Task :app:processDebugManifest FAILED

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.


Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
12 actionable tasks: 2 executed, 10 up-to-date
/Users/hackrx/Documents/MyShareFolder/MesiboTest/android/app/src/debug/AndroidManifest.xml:11:7-34 Error:
        Attribute application@allowBackup value=(false) from AndroidManifest.xml:11:7-34
        is also present at [com.mesibo.api:mesibo:1.2.30] AndroidManifest.xml:19:9-35 value=(true).
        Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:11:7-34
        is also present at [com.mesibo.api:mesibo:1.2.30] AndroidManifest.xml:19:9-35 value=(true).
        Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-117 to override.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/hackrx/Documents/MyShareFolder/MesiboTest/android/app/src/debug/AndroidManifest.xml:11:7-34 Error:
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

from samples.

mesibo avatar mesibo commented on July 24, 2024

I can see following in your logs, try it and post results

Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:7:5-117 to override.

from samples.

hackrx avatar hackrx commented on July 24, 2024

@mesibo I already tried this and this is what I got

$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 967 file(s) to forward-jetify. Using 16 workers...
info JS server already running.
info Installing the app...
> Task :app:generateDebugBuildConfig FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.3/userguide/command_line_interface.html#sec:command_line_warnings
3 actionable tasks: 2 executed, 1 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:generateDebugBuildConfig'.
> org.xml.sax.SAXParseException; systemId: file:/Users/hackrx/Documents/MyShareFolder/MesiboTest/android/app/src/main/AndroidManifest.xml; lineNumber: 13; columnNumber: 39; The prefix "tools" for attribute "tools:replace" associated with an element type "application" is not bound.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081

AndroidManifest.xml

  <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"              
      tools:replace ="android:allowBackup"      //<-----------------
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

from samples.

mesibo avatar mesibo commented on July 24, 2024

have you added xmlns:tools="http://schemas.android.com/tools" in your manifest?

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
...

I have also raised an internal request to remove allowBackup if not required.

from samples.

hackrx avatar hackrx commented on July 24, 2024

Error in Js server:

image

App.js


import React, {Component} from 'react';
import {
  Alert,
  Button,
  AppRegistry,
  Platform,
  StyleSheet,
  Text,
  View,
} from 'react-native';
import MesiboModule from './MesiboModule';

// Refer to https://mesibo.com/documentation/ to generate token
const mesiboToken =
  'xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const mesiboDestination = 'Destination User';

MesiboModule.init(mesiboToken);

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to Mesibo!</Text>
        <Text style={styles.instructions}>
          Ensure that the Storage permission is granted
        </Text>

        <View style={styles.buttonContainer}>
          <Button
            onPress={() => {
              MesiboModule.sendMessage(
                mesiboDestination,
                'Hello From React Native',
              );
            }}
            title="Send a Message"
          />
        </View>

        <Button
          onPress={() => {
            MesiboModule.launchUi(mesiboDestination);
          }}
          title="Launch UI"
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
  buttonContainer: {
    margin: 20,
  },

  alternativeLayoutButtonContainer: {
    margin: 20,
    flexDirection: 'row',
    justifyContent: 'space-between',
  },
});

MesiboModule.js

import {NativeModules} from 'react-native';
module.exports = NativeModules.MesiboModule;

This example is from sample/React-native/helloWorld
@mesibo can you guys please make a sample project available in this repo? It is too cumbersome for any beginner.

from samples.

mesibo avatar mesibo commented on July 24, 2024

we will try to help but this is our official stand.
Refer to https://mesibo.com/documentation/faq/#does-mesibo-supports-cross-platform-tools-like-flutter-react-native-ionic-etc

You should know how to use native API with your platform. Moreover, the latest reported issues have nothing to do with mesibo.

Closing the issue.

from samples.

mesibo avatar mesibo commented on July 24, 2024

We have updated the repository with a react-native sample to send messages and make video and voice calls.

A sample project is available for Android which you can build and run. You can follow similar steps to use Mesibo with React Native in iOS by creating a Native Module in iOS.

from samples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.