react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

React Native firebase Twitter issue

Open mehraj43 opened this issue 3 years ago • 2 comments

hii im getting error when trying to build my app im trying to use firebase twitter login im sharing the error below plzz help me

first i was getting this issue when i did npx react-native run-android:

BUILD FAILED in 17s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception. Required by: project :app > project :react-native-twitter-signin_twitter-signin

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 17s

at makeError (C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9) at C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async runOnAllDevices (C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5) at async Command.handleAction (C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli\build\index.js:192:9) info Run CLI with --verbose flag for more details.

after cleaning graddle im getting this error now:

BUILD FAILED in 19s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

What went wrong: Could not determine the dependencies of task ':app:mergeDebugAssets'. Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not find com.twitter.sdk.android:twitter-core:3.3.0. Searched in the following locations:

  • https://repo.maven.apache.org/maven2/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom at makeError (C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9) at C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16 at processTicksAndRejections (node:internal/process/task_queues:96:5) at async runOnAllDevices (C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5) at async Command.handleAction (C:\Users\mehra\OneDrive\Desktop\React_Native_Practise\FirstProj\node_modules@react-native-community\cli\build\index.js:192:9) info Run CLI with --verbose flag for more details.

mehraj43 avatar Aug 09 '22 07:08 mehraj43

this is the error im getting after installing twitter

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':react-native-twitter-signin_twitter-signin:compileDebugAidl'.

Could not resolve all task dependencies for configuration ':react-native-twitter-signin_twitter-signin:debugCompileClasspath'. Could not find com.twitter.sdk.android:twitter-core:3.3.0. Required by: project :react-native-twitter-signin_twitter-signin

mehraj43 avatar Aug 10 '22 04:08 mehraj43

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

  • What went wrong: Could not determine the dependencies of task ':app:mergeDebugAssets'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'. Could not find com.twitter.sdk.android:twitter-core:3.3.0. Searched in the following locations: - file:/C:/Users/mehra/.m2/repository/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom - https://repo.maven.apache.org/maven2/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom - file:/C:/Users/mehra/OneDrive/Desktop/React_Native_Practise/firstproj/node_modules/react-native/android/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom - file:/C:/Users/mehra/OneDrive/Desktop/React_Native_Practise/firstproj/node_modules/jsc-android/dist/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom - https://dl.google.com/dl/android/maven2/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom - https://www.jitpack.io/com/twitter/sdk/android/twitter-core/3.3.0/twitter-core-3.3.0.pom Required by: project :app > project :react-native-twitter-signin_twitter-signin

mehraj43 avatar Aug 10 '22 04:08 mehraj43

Adding jcenter() in root level build.gradle works for me.

buildscript {
...
repositories {
        mavenCentral()
        jcenter()
}
...
allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        jcenter()
...
   }
}

jumandika avatar Sep 08 '22 02:09 jumandika

Adding jcenter() in root level build.gradle works for me.

buildscript {
...
repositories {
        mavenCentral()
        jcenter()
}
...
allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        jcenter()
...
   }
}

yeah it will install the twitter but are u able to fetch details from Twitter bcoz im getting an error stating email couldn't be fetched plzz do tell me if u are getting proper response

mehraj43 avatar Sep 08 '22 03:09 mehraj43

Thanks for answering i resolved the above mentioned issue earlier but are u able to fetch the details from Twitter now bcoz i was getting an error stating that email couldn't be fetched

On Thu, Sep 8, 2022, 08:25 jumandika @.***> wrote:

Adding jcenter() in root level build.gradle works for me.

buildscript { ... repositories { mavenCentral() jcenter() } ... allprojects { repositories { mavenCentral() mavenLocal() jcenter() ... }

— Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/6459#issuecomment-1240156247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYIMHVPWF5T6DE5NWHCMLLV5FISRANCNFSM557VH2QA . You are receiving this because you authored the thread.Message ID: @.***>

mehraj43 avatar Sep 08 '22 03:09 mehraj43

Adding jcenter() in root level build.gradle works for me.

buildscript {
...
repositories {
        mavenCentral()
        jcenter()
}
...
allprojects {
    repositories {
        mavenCentral()
        mavenLocal()
        jcenter()
...
   }
}

yeah it will install the twitter but are u able to fetch details from Twitter bcoz im getting an error stating email couldn't be fetched plzz do tell me if u are getting proper response

I think I got proper response as follow:

{
    "email": "[email protected]",
    "userName": "AchmadJumandika",
    "userID": "15648175997198xxxxx",
    "name": "AchmadJumandika",
    "authTokenSecret": "JjjNDxwuaOv5chBhU69keWRsZfFfPdsasjzAxxxxxxxxx",
    "authToken": "15648175997198xxxxx-FPOOuorjI02ua5C5jdcfrH5wxxxxxx"
}

jumandika avatar Sep 08 '22 03:09 jumandika

Thanks, I'll check it out.

On Thu, Sep 8, 2022, 09:13 jumandika @.***> wrote:

Adding jcenter() in root level build.gradle works for me.

buildscript { ... repositories { mavenCentral() jcenter() } ... allprojects { repositories { mavenCentral() mavenLocal() jcenter() ... } }

yeah it will install the twitter but are u able to fetch details from Twitter bcoz im getting an error stating email couldn't be fetched plzz do tell me if u are getting proper response

I think I got proper response as follow:

"email": ***@***.***",
"userName": "AchmadJumandika",
"userID": "15648175997198xxxxx",
"name": "AchmadJumandika",
"authTokenSecret": "JjjNDxwuaOv5chBhU69keWRsZfFfPdsasjzAxxxxxxxxx",
"authToken": "15648175997198xxxxx-FPOOuorjI02ua5C5jdcfrH5wxxxxxx"

}```

— Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/6459#issuecomment-1240180571, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYIMHW46ACXAPJGCPJYIJ3V5FOFLANCNFSM557VH2QA . You are receiving this because you modified the open/close state.Message ID: @.***>

mehraj43 avatar Sep 08 '22 03:09 mehraj43

Hey I'm still getting error stating that email couldn't be fetched can u tell me which version of React Native are u using and are u using oAuth2 or oAuth1 or both

On Thu, Sep 8, 2022, 09:17 Mohammed Meraj Malik @.***> wrote:

Thanks, I'll check it out.

On Thu, Sep 8, 2022, 09:13 jumandika @.***> wrote:

Adding jcenter() in root level build.gradle works for me.

buildscript { ... repositories { mavenCentral() jcenter() } ... allprojects { repositories { mavenCentral() mavenLocal() jcenter() ... } }

yeah it will install the twitter but are u able to fetch details from Twitter bcoz im getting an error stating email couldn't be fetched plzz do tell me if u are getting proper response

I think I got proper response as follow:

"email": ***@***.***",
"userName": "AchmadJumandika",
"userID": "15648175997198xxxxx",
"name": "AchmadJumandika",
"authTokenSecret": "JjjNDxwuaOv5chBhU69keWRsZfFfPdsasjzAxxxxxxxxx",
"authToken": "15648175997198xxxxx-FPOOuorjI02ua5C5jdcfrH5wxxxxxx"

}```

— Reply to this email directly, view it on GitHub https://github.com/invertase/react-native-firebase/issues/6459#issuecomment-1240180571, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYIMHW46ACXAPJGCPJYIJ3V5FOFLANCNFSM557VH2QA . You are receiving this because you modified the open/close state.Message ID: @.***>

mehraj43 avatar Sep 08 '22 14:09 mehraj43

Hey, I use RN version "react-native": "0.66.3" and I use this dependecy for APIs functionalities "@react-native-twitter-signin/twitter-signin": "^1.2.0"

jumandika avatar Sep 10 '22 00:09 jumandika

Hey 👋 , I solve this issue by adding some things in my "android/build.gradle" & "android/app/build.gradle", Bellow is the changes that i made in mine files:

  1. android/build.gradle

`// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "33.0.0" minSdkVersion = 24 compileSdkVersion = 33 targetSdkVersion = 33

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
    kotlinVersion = '1.8.10'
}
repositories {
    google()
    mavenCentral()
    // Add this line
    jcenter()
    maven { url = uri("https://jitpack.io") }
}
dependencies {
    classpath("com.android.tools.build:gradle")
    classpath("com.facebook.react:react-native-gradle-plugin")
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
    classpath 'com.google.gms:google-services:4.3.15'
    classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
}

// Add this lines
allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
        maven { url = uri("https://jitpack.io") }
    }
}

} `

Basically you need to add the " jcenter()" in side the "repositories" object and as well the "allprojects" object, Note: if the "allprojects" not exists in your build.gradle create one of it.

  1. android/app/build.gradle

`apply plugin: "com.android.application" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'kotlin-android'

/**

  • This is the configuration block to customize your React Native Android app.

  • By default you don't need to apply any configuration, just uncomment the lines you need. / react { / Folders */ // The root of your project, i.e. where "package.json" lives. Default is '..' // root = file("../") // The folder where the react-native NPM package is. Default is ../node_modules/react-native // reactNativeDir = file("../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen // codegenDir = file("../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js // cliFile = file("../node_modules/react-native/cli.js")

    /* Variants */ // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"]

    /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = []

    /* Hermes Commands */ // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] }

/**

  • Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false

/**

  • The preferred build flavor of JavaScriptCore (JSC)
  • For example, to use the international variant, you can use:
  • def jscFlavor = 'org.webkit:android-jsc-intl:+'
  • The international variant includes ICU i18n library and necessary data
  • allowing to use e.g. Date.toLocaleString and String.localeCompare that
  • give correct results when using with locales other than en-US. Note that
  • this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+'

android { ndkVersion rootProject.ext.ndkVersion

compileSdkVersion rootProject.ext.compileSdkVersion

namespace "com.bolonow"
defaultConfig {
    applicationId "com.bolonow"
    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"
    }
}
packagingOptions {
    pickFirst 'lib/x86/libcrypto.so'
    pickFirst 'lib/x86_64/libcrypto.so'
    pickFirst 'lib/armeabi-v7a/libcrypto.so'
    pickFirst 'lib/arm64-v8a/libcrypto.so'
}

}

dependencies { // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") implementation platform('com.google.firebase:firebase-bom:32.0.0') implementation("androidx.browser:browser:1.2.0") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.0") implementation("com.github.lincollincol:amplituda:2.2.2") implementation project(':react-native-fbsdk-next') implementation 'com.facebook.android:facebook-android-sdk:latest.release' implementation 'com.twitter.sdk.android:twitter-core:3.3.0' debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { exclude group:'com.squareup.okhttp3', module:'okhttp' }

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
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) `

Basically, I add the implementation 'com.twitter.sdk.android:twitter-core:3.3.0' inside the "dependencies" object, Note: change the version according to your requirements i use the "3.3.0",

  1. By doing these changes save the file and run the npx react-native run-android

devlprkhan avatar Dec 20 '23 09:12 devlprkhan