jitsi / jitsi-meet-sdk-samples

Jitsi Meet mobile SDK examples (Android, iOS and React Native)
Apache License 2.0
283 stars 240 forks source link

Can not run app, getting errors related to the React Native Community Clipboard #234

Open NguyenTran153 opened 6 months ago

NguyenTran153 commented 6 months ago

I'm getting errors related to the React Native Community Clipboard package after running yarn android

D:\Project\DATN\android\app\src\debug\AndroidManifest.xml Warning: uses-feature#android.hardware.usb.host was tagged at AndroidManifest.xml:0 to replace another declaration but no other declaration present

Task :react-native-community_clipboard:compileDebugJavaWithJavac FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings 292 actionable tasks: 6 executed, 286 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:14: error: cannot find symbol
import com.facebook.react.bridge.ContextBaseJavaModule; ^ symbol: class ContextBaseJavaModule location: package com.facebook.react.bridge D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:23: error: cannot find symbol
public class ClipboardModule extends ContextBaseJavaModule { ^ symbol: class ContextBaseJavaModule D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:31: error: method does not override or implement a method from a supertype @Override ^ D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:37: error: cannot find symbol
return (ClipboardManager) getContext().getSystemService(getContext().CLIPBOARD_SERVICE); ^ symbol: method getContext() location: class ClipboardModule D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:37: error: cannot find symbol
return (ClipboardManager) getContext().getSystemService(getContext().CLIPBOARD_SERVICE); ^ symbol: method getContext() location: class ClipboardModule D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardPackage.java:23: error: incompatible types: ClipboardModule cannot be converted to NativeModule modules.add(new ClipboardModule(reactContext)); ^ Note: D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 6 errors

FAILURE: Build failed with an exception.

BUILD FAILED in 30s error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081 D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:14: error: cannot find symbol import com.facebook.react.bridge.ContextBaseJavaModule; ^ symbol: class ContextBaseJavaModule location: package com.facebook.react.bridge D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:23: error: cannot find symbol public class ClipboardModule extends ContextBaseJavaModule { ^ symbol: class ContextBaseJavaModule D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:31: error: method does not override or implement a method from a supertype @Override ^ D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:37: error: cannot find symbol return (ClipboardManager) getContext().getSystemService(getContext().CLIPBOARD_SERVICE); ^ symbol: method getContext() location: class ClipboardModule D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java:37: error: cannot find symbol return (ClipboardManager) getContext().getSystemService(getContext().CLIPBOARD_SERVICE); ^ symbol: method getContext() location: class ClipboardModule D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardPackage.java:23: error: incompatible types: ClipboardModule cannot be converted to NativeModule modules.add(new ClipboardModule(reactContext)); ^ Note: D:\Project\DATN\node_modules\@react-native-community\clipboard\android\src\main\java\com\reactnativecommunity\clipboard\ClipboardModule.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output 6 errors FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':react-native-community_clipboard:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. 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 30s. info Run CLI with --verbose flag for more details.

This is my ### build.gradle ` buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 21 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" } repositories { google() mavenCentral() } dependencies { classpath("com.android.tools.build:gradle") classpath("com.facebook.react:react-native-gradle-plugin") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") classpath 'com.google.gms:google-services:4.3.14' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2' } }

apply plugin: "com.facebook.react.rootproject" `

### app/build.gradle `apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react"

/**

/**

/**

android { ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.ext.compileSdkVersion

namespace "com.datn"
defaultConfig {
    applicationId "com.datn"
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 1
    versionName "1.0"
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

}

dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation("com.facebook.react:flipper-integration") implementation project(':react-native-vector-icons')

if (hermesEnabled.toBoolean()) {
    implementation("com.facebook.react:hermes-android")
} else {
    implementation jscFlavor
}

}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply from: file("../../node_modules/react-native-vector-icons/fonts.gradle") `

package.json

{ "name": "DATN", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint .", "start": "react-native start", "test": "jest" }, "dependencies": { "@amplitude/react-native": "2.7.0", "@braintree/sanitize-url": "7.0.0", "@giphy/react-native-sdk": "2.3.0", "@jitsi/react-native-sdk": "^2.2.1", "@material/material-color-utilities": "^0.2.7", "@react-native-async-storage/async-storage": "1.19.4", "@react-native-community/clipboard": "1.5.1", "@react-native-community/netinfo": "11.1.0", "@react-native-community/slider": "4.4.3", "@react-native-google-signin/google-signin": "10.1.0", "@react-native/metro-config": "0.72.9", "@react-navigation/bottom-tabs": "^6.5.20", "@react-navigation/material-bottom-tabs": "^6.2.28", "@react-navigation/native": "^6.1.17", "@react-navigation/native-stack": "^6.9.26", "@reduxjs/toolkit": "^2.2.3", "@types/react-native-vector-icons": "^6.4.18", "healthicons-react-native": "^1.4.0", "i": "^0.3.7", "lottie-react-native": "^6.7.2", "npm": "^10.5.2", "react": "18.2.0", "react-native": "0.73.6", "react-native-background-timer": "2.4.1", "react-native-calendar-events": "2.2.0", "react-native-calendars": "^1.1304.1", "react-native-default-preference": "1.4.4", "react-native-device-info": "10.9.0", "react-native-gesture-handler": "2.9.0", "react-native-get-random-values": "1.9.0", "react-native-gifted-chat": "^2.4.0", "react-native-immersive-mode": "2.0.1", "react-native-keep-awake": "4.0.0", "react-native-linear-gradient": "^2.8.3", "react-native-orientation-locker": "1.6.0", "react-native-pager-view": "6.2.0", "react-native-paper": "5.10.3", "react-native-performance": "5.0.0", "react-native-qrcode-svg": "^6.3.0", "react-native-safe-area-context": "4.7.1", "react-native-screens": "3.24.0", "react-native-sound": "0.11.2", "react-native-splash-screen": "3.3.0", "react-native-svg": "13.13.0", "react-native-vector-icons": "^10.0.3", "react-native-video": "6.0.0-alpha.11", "react-native-watch-connectivity": "1.1.0", "react-native-webrtc": "118.0.6", "react-native-webview": "13.5.1", "react-redux": "^9.1.2", "text-encoding": "0.7.0" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/babel-preset": "0.73.21", "@react-native/eslint-config": "0.73.2", "@react-native/metro-config": "0.73.5", "@react-native/typescript-config": "0.73.1", "@types/color": "^3.0.6", "@types/jest": "^29.5.12", "@types/react": "^18.2.6", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.6.3", "eslint": "^8.19.0", "jest": "^29.6.3", "prettier": "2.8.8", "react-test-renderer": "18.2.0", "typescript": "5.0.4" }, "engines": { "node": ">=18" }, "overrides": { "@xmldom/xmldom": "0.8.7" } }

Android Manifest

`

<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="false" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true">

  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="datn" />
  </intent-filter>
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="http" />
    <data android:scheme="https" />
    <data android:host="www.datn.com.vn" />
  </intent-filter>
</activity>

`

How can I fix this? Thank you so much

saghul commented 6 months ago

I'd recomend you use RN 0.72 and Gradle 7 since that's what our SDK is built with.

edritech93 commented 5 months ago

same issue with RN 0.74 but no issue with RN 0.72

Calinteodor commented 3 months ago

That dependency has changed to @react-native-clipboard/clipboard.