Open deleonjuan opened 10 months ago
Same issue Could not find com.twitter.sdk.android:twitter:3.3.0. Did you get any solution for the same?
FAILURE: Build failed with an exception.
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://oss.sonatype.org/content/repositories/snapshots/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:/E:/cBidzNV2/cBidzRV2/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
i found solution
actually the jcenter repository url has been changed so this
buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 21 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0" }
repositories {
google()
mavenCentral()
jcenter()
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
**maven { url 'https://jcenter.bintray.com/' }** (this jcenter url need to write) and u will get working code
} }
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}
apply plugin: "com.facebook.react.rootproject"
Any updates on this issue? It wasn't working for me yet.
in android 14 some settings seed to do ..i will share with you just given me some time ..
can you share your error .. what error are you facing ?
Sure, my problem is exactly what've been described in the issue title, it's not able to find com.twitter.sdk.android:twitter-core:3.3.0.
I've tried to use maven {url: '
"@react-native-twitter-signin/twitter-signin": "^1.2.0", this is my plugin From Package.json
create a network security file in res folder <?xml version="1.0" encoding="utf-8"?>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network_security_config"
android:allowBackup="false"
android:theme="@style/AppTheme">
android->app->build.gradel
apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" apply plugin: 'com.google.gms.google-services' apply from: "../../node_modules/react-native-vector-icons/fonts.gradle" /**
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"] }
/**
/**
def jscFlavor = 'org.webkit:android-jsc-intl:+'
Date.toLocaleString
and String.localeCompare
thatandroid { ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.ext.compileSdkVersion
namespace <yourapp namespace>
defaultConfig {
applicationId <your app application id>
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.fresco:animated-gif:3.1.0") implementation("com.facebook.react:flipper-integration") implementation project(':react-native-vector-icons') implementation platform('com.google.firebase:firebase-bom:32.7.2') implementation 'com.stripe:stripe-android:20.42.0' //implementation project(':react-native-splash-screen') implementation project(':react-native-push-notification') implementation project(':react-native-splash-screen') //implementation project(':react-native-twitter-signin') //implementation project(':react-native-login-twitter') //implementation 'com.twitter.sdk.android:twitter-core:3.2.0' 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)
android-> build.gradel
buildscript { ext { buildToolsVersion = "34.0.0" minSdkVersion = 21 compileSdkVersion = 34 targetSdkVersion = 28 ndkVersion = "25.1.8937393" kotlinVersion = "1.8.0"
}
repositories {
google()
mavenCentral()
jcenter()
}
allprojects {
repositories {
mavenCentral()
mavenLocal()
maven { url 'https://jcenter.bintray.com/' }
} }
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
// classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
classpath 'com.google.gms:google-services:4.3.15'
}
}
apply plugin: "com.facebook.react.rootproject" apply plugin: 'com.google.gms.google-services'
please check with this code i hope this will helpful for you . twitter is working perfectly working in my project please use the twitter plugin which i mention on the top and config accordingly .definitely this will work
<?xml version="1.0" encoding="utf-8"?>
Awesome, I'll try later and keep you posted. Thank you so much!
Is someone able to do twitter auth in React Native version greater that 0.70
Yes
On Thu, 4 Jul, 2024, 2:44 pm UMER DOGAR, @.***> wrote:
Is someone able to do twitter auth in React Native version greater that 0.70
— Reply to this email directly, view it on GitHub https://github.com/react-native-twitter-signin/twitter-signin/issues/21#issuecomment-2208495264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGATXHX7GL6U3PUDABNOQKLZKUG7VAVCNFSM6AAAAABJUGBBBCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYGQ4TKMRWGQ . You are receiving this because you commented.Message ID: @.*** com>
Did you fix it @devGbarbosa? seems happening to me same as you after @shuklaom84 recommendations. I'm using react-native@0.74.0 and @react-native-twitter-signin/twitter-signin@1.2.0
In my app i did and it's working
On Thu, 11 Jul, 2024, 12:22 pm Eric Torres, @.***> wrote:
Did you fix it @devGbarbosa https://github.com/devGbarbosa? seems happening to me same as you after @shuklaom84 https://github.com/shuklaom84 recommendations. I'm using @. and @@.
— Reply to this email directly, view it on GitHub https://github.com/react-native-twitter-signin/twitter-signin/issues/21#issuecomment-2222171281, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGATXHXADZEUAKRG5R6ZFE3ZLYTTXAVCNFSM6AAAAABJUGBBBCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRSGE3TCMRYGE . You are receiving this because you were mentioned.Message ID: @.*** com>
I wonder if could u testing again in a new project with RN 0.74.3 and share ur thoughts about it @shuklaom84
I tried adding source code of the twitter-core in my fork https://github.com/bdtren/twitter-signin, fixed the issue. But it seem useless now. In latest X app, old intent call not working anymore, even twitter://
, twitterauth://
and x://
not working
hi guys , we need to change the login system .. remove everything and use below mention code in seprate tsx file
import Axios from 'axios'; import OAuth from 'oauth-1.0a'; import {useEffect} from 'react'; import {Alert, Linking} from 'react-native'; import Config from 'react-native-config'; import crypto from 'react-native-quick-crypto';
const CONSUMER_KEY = Config.TWITTER_CONSUMER_KEY; const CONSUMER_SECRET = Config.TWITTER_CONSUMER_SECRET; const TWITTER_API = 'https://api.twitter.com'; const OAUTH_CALLBACK_URL = 'oauth-app://oauth'; // your app scheme
export const useSignInWithTwitter = () => { // request token const signInWithTwitter = async () => { const oauth = new OAuth({ consumer: { key: CONSUMER_KEY, secret: CONSUMER_SECRET, }, signature_method: 'HMAC-SHA1', hash_function: (baseString, key) => crypto.createHmac('sha1', key).update(baseString).digest('base64'), });
const request_data = {
url: `${TWITTER_API}/oauth/request_token`,
method: 'POST',
data: { oauth_callback: OAUTH_CALLBACK_URL },
};
const headers = {
...oauth.toHeader(
oauth.authorize({
url: request_data.url,
method: request_data.method,
data: { oauth_callback: OAUTH_CALLBACK_URL },
})
),
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
};
try {
// Remove the empty {} body from the post request
const res = await Axios.post(request_data.url, null, { headers });
const responseData = res.data;
const requestToken = responseData.match(/oauth_token=([^&]+)/)[1];
// Redirect to Twitter login
const twitterLoginURL = `${TWITTER_API}/oauth/authenticate?oauth_token=${requestToken}`;
Linking.openURL(twitterLoginURL);
} catch (error:any) {
console.log('Error in request token:', error.response?.data || error.message);
}
};
useEffect(() => { const subscribe = Linking.addEventListener( 'url', async (event: { url: string }) => { const url = event.url; const params = url.split('?')[1]; const tokenParts = params.split('&'); const requestToken = tokenParts[0].split('=')[1]; const oauthVerifier = tokenParts[1].split('=')[1];
const oauth = new OAuth({
consumer: {
key: CONSUMER_KEY,
secret: CONSUMER_SECRET,
},
signature_method: 'HMAC-SHA1',
hash_function: (baseString, key) =>
crypto.createHmac('sha1', key).update(baseString).digest('base64'),
});
const request_data = {
url: `${TWITTER_API}/oauth/access_token`,
method: 'POST',
data: {
oauth_token: requestToken,
oauth_verifier: oauthVerifier,
},
};
try {
const res = await Axios.post(
request_data.url,
null,
{ headers: { ...oauth.toHeader(oauth.authorize(request_data)) } },
);
const responseData = res.data;
const authToken = responseData.match(/oauth_token=([^&]+)/)[1];
const authTokenSecret = responseData.match(/oauth_token_secret=([^&]+)/)[1];
Alert.alert(
'Success',
`authToken: ${authToken.slice(0, 7) + '...'}\nauthTokenSecret: ${
authTokenSecret.slice(1, 7) + '...'
}`,
);
} catch (error:any) {
console.log('Error: access token', error.response?.data || error.message);
}
},
);
return () => subscribe.remove();
}, []);
return { signInWithTwitter, }; };
Error--------------
Task :react-native-quick-base64:configureCMakeDebug[arm64-v8a] C/C++: CMake Warning (dev) in CMakeLists.txt: C/C++: No project() command is present. The top-level CMakeLists.txt file must C/C++: contain a literal, direct call to the project() command. Add a line of C/C++: code such as C/C++: project(ProjectName) C/C++: near the top of the file, but after cmake_minimum_required(). C/C++: CMake is pretending there is a "project(Project)" command on the first C/C++: line. C/C++: This warning is for project developers. Use -Wno-dev to suppress it.
Task :app:mergeExtDexDebug Task :react-native-quick-base64:buildCMakeDebug[arm64-v8a] 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 scri pts or plugins.
See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings 79 actionable tasks: 74 executed, 5 up-to-date
info 💡 Tip: Make sure that you have set up your development environment correctly, by running react-native doctor. To rea d more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#d octor
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':react-native-quick-base64:buildCMakeDebug[arm64-v8a]'.
Unable to delete file 'D:\cbidz Twit rnd\txttest1\node_modules\react-native-quick-base64\android\build\intermediates\cxx \Debug\5h495514\obj\arm64-v8a'
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 56s info Run CLI with --verbose flag for more details.
Solution-----------
The error you encountered suggests several issues related to CMake configuration, Gradle deprecation warnings, and file deletion failure during the build process for the react-native-quick-base64 package in a React Native project. Let's break down the main issues and provide solutions:
code to add got to node_modules->react-native-quick-base64->android->CMakeLists.txt in this file add below mention line or add only project name i added only project name
cmake_minimum_required(VERSION 3.4.1) project(YourProjectName)
Solution: Run the following command to view all deprecation warnings: bash Copy code ./gradlew build --warning-mode all Update the scripts or plugins as per the Gradle documentation or use plugins that are compatible with the latest Gradle versions. You can consult the Gradle documentation for more details. go to android folder and run below command
./gradlew build --warning-mode all
The error you encountered suggests several issues related to CMake configuration, Gradle deprecation warnings, and file deletion failure during the build process for the react-native-quick-base64 package in a React Native project. Let's break down the main issues and provide solutions:
Solution: Add the project() command in your CMakeLists.txt. For example: cmake Copy code cmake_minimum_required(VERSION 3.4.1) project(YourProjectName)
This will remove the warning about missing a project command.
Solution: Run the following command to view all deprecation warnings: bash Copy code ./gradlew build --warning-mode all Update the scripts or plugins as per the Gradle documentation or use plugins that are compatible with the latest Gradle versions. You can consult the Gradle documentation for more details.
Unable to Delete File Issue: The build is failing because a file cannot be deleted during the build process: D:\cbidz Twit rnd\txttest1\node_modules\react-native-quick-base64\android\build\intermediates\cxx\Debug\5h495514\obj\arm64-v8a Solution: Ensure no other processes (like antivirus or file sync services) are locking the file. Close any open IDEs (like Android Studio or VS Code) and try deleting the file manually.
You can also clean the build using: bash Copy code
commands need to run ./gradlew clean
After cleaning, attempt to rebuild: bash Copy code
./gradlew assembleDebug
command -------------------------------- npx react-native doctor
may be you will face this issue
✓ Node.js - Required to execute JavaScript code ✖ yarn - Required to install NPM dependencies
Version found: N/A
Version supported: >= 1.10.x
Solution commands ------------------- install npm install -g yarn
final code
import Axios from 'axios'; import OAuth from 'oauth-1.0a'; import {useEffect} from 'react'; import {Alert, Linking} from 'react-native'; import Config from 'react-native-config'; import crypto from 'react-native-quick-crypto';
const CONSUMER_KEY =
export const useSignInWithTwitter = () => { // request token const signInWithTwitter = async () => { const oauth = new OAuth({ consumer: { key: CONSUMER_KEY, secret: CONSUMER_SECRET, }, signature_method: 'HMAC-SHA1', hash_function: (baseString, key) => crypto.createHmac('sha1', key).update(baseString).digest('base64'), });
const request_data = {
url: `${TWITTER_API}/oauth/request_token`,
method: 'POST',
data: { oauth_callback: OAUTH_CALLBACK_URL },
};
const headers = {
...oauth.toHeader(
oauth.authorize({
url: request_data.url,
method: request_data.method,
data: { oauth_callback: OAUTH_CALLBACK_URL },
})
),
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
};
try {
// Remove the empty {} body from the post request
const res = await Axios.post(request_data.url, null, { headers });
const responseData = res.data;
const requestToken = responseData.match(/oauth_token=([^&]+)/)[1];
// Redirect to Twitter login
const twitterLoginURL = `${TWITTER_API}/oauth/authenticate?oauth_token=${requestToken}`;
Linking.openURL(twitterLoginURL);
} catch (error) {
console.log('Error in request token:', error.response?.data || error.message);
}
};
useEffect(() => { const subscribe = Linking.addEventListener( 'url', async (event: { url: string }) => { const url = event.url; const params = url.split('?')[1]; const tokenParts = params.split('&'); const requestToken = tokenParts[0].split('=')[1]; const oauthVerifier = tokenParts[1].split('=')[1];
const oauth = new OAuth({
consumer: {
key: CONSUMER_KEY,
secret: CONSUMER_SECRET,
},
signature_method: 'HMAC-SHA1',
hash_function: (baseString, key) =>
crypto.createHmac('sha1', key).update(baseString).digest('base64'),
});
const request_data = {
url: `${TWITTER_API}/oauth/access_token`,
method: 'POST',
data: {
oauth_token: requestToken,
oauth_verifier: oauthVerifier,
},
};
try {
const res = await Axios.post(
request_data.url,
null,
{ headers: { ...oauth.toHeader(oauth.authorize(request_data)) } },
);
const responseData = res.data;
const authToken = responseData.match(/oauth_token=([^&]+)/)[1];
const authTokenSecret = responseData.match(/oauth_token_secret=([^&]+)/)[1];
Alert.alert(
'Success',
`authToken: ${authToken.slice(0, 7) + '...'}\nauthTokenSecret: ${
authTokenSecret.slice(1, 7) + '...'
}`,
);
} catch (error) {
console.log('Error: access token', error.response?.data || error.message);
}
},
);
return () => subscribe.remove();
}, []);
return { signInWithTwitter, }; };
{ "name": "login", "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": { "axios": "^1.6.1", "oauth-1.0a": "^2.2.6", "react": "18.2.0", "react-native": "0.72.6", "react-native-config": "^1.5.1", "react-native-quick-base64": "^2.0.7", "react-native-quick-crypto": "^0.6.1" }, "devDependencies": { "@babel/core": "^7.20.0", "@babel/preset-env": "^7.20.0", "@babel/runtime": "^7.20.0", "@react-native/eslint-config": "^0.72.2", "@react-native/metro-config": "^0.72.11", "@tsconfig/react-native": "^3.0.0", "@types/react": "^18.0.24", "@types/react-test-renderer": "^18.0.0", "babel-jest": "^29.2.1", "babel-plugin-module-resolver": "^5.0.0", "eslint": "^8.19.0", "jest": "^29.2.1", "metro-react-native-babel-preset": "0.76.8", "prettier": "^2.4.1", "react-test-renderer": "18.2.0", "typescript": "4.8.4" }, "engines": { "node": ">=16" } }
did someone resolve this?
Hey - I'm tring to use this library but I'm getting the next error. I just npm installed the package and then when
npm start
andnpm run android
I get the error.I followed the instructions in the README.md and from here https://rnfirebase.io/auth/social-auth, but no success.