GoldenOwlAsia / react-native-twitter-signin

MIT License
167 stars 304 forks source link

Unable to find explicit activity class {/com.twitter.sdk.android.core.identity.OAuthActivity} #131

Open kkusanagi opened 5 years ago

kkusanagi commented 5 years ago

Once call RNTwitterSignIn.init(....), it return error. Had added within AndroidManifest. But still error.

using "react-native-twitter-signin": "^1.1.1"

package.json

{
    "name": "tootitoo",
    "version": "1.12.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "bad-words": "^3.0.2",
        "geofirestore": "^2.3.0",
        "moment": "^2.22.2",
        "react": "^16.6.1",
        "react-native": "^0.59.4",
        "react-native-audio": "^3.6.0",
        "react-native-autolink": "^1.8.1",
        "react-native-calendar-events": "^1.6.3",
        "react-native-calendars": "^1.21.0",
        "react-native-camera": "^1.3.1",
        "react-native-check-box": "^2.1.6",
        "react-native-elements": "^1.1.0",
        "react-native-fbads": "^6.0.2",
        "react-native-fbsdk": "^0.8.0",
        "react-native-fetch-blob": "^0.10.8",
        "react-native-firebase": "^5.2.2",
        "react-native-fs": "^2.13.3",
        "react-native-gesture-handler": "^1.0.15",
        "react-native-google-signin": "^1.2.1",
        "react-native-image-picker": "^0.26.10",
        "react-native-maps": "^0.22.1",
        "react-native-mime-types": "^2.2.1",
        "react-native-modal-datetime-picker": "^6.0.0",
        "react-native-orientation-locker": "^1.0.21",
        "react-native-permissions": "^1.1.1",
        "react-native-qrcode-svg": "^5.1.1",
        "react-native-responsive-fontsize": "^0.1.8",
        "react-native-slider": "^0.11.0",
        "react-native-sound": "^0.10.9",
        "react-native-svg": "^9.3.7",
        "react-native-twitter-signin": "^1.1.1",
        "react-native-vector-icons": "^6.4.0",
        "react-navigation": "^3.3.2",
        "realm": "^2.26.1"
    },
    "devDependencies": {
        "babel-jest": "21.2.0",
        "jest": "21.2.1",
        "metro-react-native-babel-preset": "^0.45.0",
        "react-test-renderer": "16.0.0",
        "schedule": "^0.4.0"
    },
    "jest": {
        "preset": "react-native"
    }
}

build.gradle

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

buildscript {
    repositories {
        mavenLocal()
        google()
        jcenter()
        maven {
            url 'https://maven.fabric.io/public'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.2'
        classpath 'com.google.gms:google-services:4.0.1'
        classpath 'io.fabric.tools:gradle:1.25.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
    afterEvaluate {
        android {
            compileSdkVersion 27
            //buildToolsVersion "27.0.3"

            defaultConfig {
                targetSdkVersion 27
            }
        }
    }
}

allprojects {
    repositories {
        mavenLocal()
        google()
        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.google.com'
        //}

        jcenter()
        configurations.all {
            resolutionStrategy {
                force 'com.facebook.android:facebook-android-sdk:4.35.0'
            }
        }
    }
}

ext { googlePlayServicesVersion = "15.0.1" }

app/build.gradle

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

import com.android.build.OutputFile

project.ext.react = [
    entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 28
    //buildToolsVersion "27.0.3"

    defaultConfig {
        applicationId "com.tootitoo.tootitoo"
        minSdkVersion 21
        targetSdkVersion 27
        versionCode 18
        versionName "1.2.1"
        multiDexEnabled true
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    implementation project(':react-native-twitter-signin')
    implementation project(':react-native-fs')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-gesture-handler')
    implementation project(':realm')
    implementation project(':react-native-svg')
    implementation(project(':react-native-maps')){
       exclude group: 'com.google.android.gms', module: 'play-services-base'
       exclude group: 'com.google.android.gms', module: 'play-services-maps'
   }
    implementation project(':react-native-calendar-events')
    implementation project(':react-native-orientation-locker')
    implementation(project(":react-native-google-signin")){         
        exclude group: "com.google.android.gms" // very important
    }
    implementation (project(':react-native-camera')) {
        exclude group: "com.google.android.gms"
        implementation 'com.android.support:exifinterface:25.+'
    }
    implementation project(':react-native-fbads')
    implementation project(':react-native-fbsdk')
    implementation project(':react-native-sound')
    implementation project(':react-native-audio')
    implementation project(':react-native-image-picker')
    implementation(project(':react-native-firebase')) {
        transitive = false
    }
    // Firebase dependencies
    implementation "com.google.android.gms:play-services-base:16.0.1"
    implementation "com.google.android.gms:play-services-maps:16.0.0"
    implementation "com.google.android.gms:play-services-ads:16.0.0"

    implementation "com.google.firebase:firebase-core:16.0.6"

    implementation "com.google.android.gms:play-services-auth:16.0.1" // Add this, not 9.8.0 (from instructions).

    implementation "com.facebook.android:audience-network-sdk:4.+"

    // RNFirebase optional dependencies
    // implementation "com.google.firebase:firebase-ads:15.0.1"
    implementation "com.google.firebase:firebase-auth:16.0.5"
    implementation "com.google.firebase:firebase-config:16.1.0"
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true
    }
    implementation "com.google.firebase:firebase-database:16.0.4"
    implementation "com.google.firebase:firebase-firestore:17.1.2"
    implementation "com.google.firebase:firebase-invites:16.0.6"
    implementation "com.google.firebase:firebase-messaging:17.3.4"
    //implementation "com.google.firebase:firebase-perf:12.0.1"
    implementation "com.google.firebase:firebase-storage:16.0.4"

    implementation project(':react-native-fetch-blob')
    implementation project(':react-native-fbsdk')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:26.0.3"
    implementation "com.facebook.android:facebook-android-sdk:4.34.0"
    implementation "com.facebook.react:react-native:+"  // From node_modules

    // For animated GIF support

    implementation 'com.facebook.fresco:fresco:1.11.+'
    implementation 'com.facebook.fresco:animated-gif:1.11.+'

    // For WebP support, including animated WebP
    implementation 'com.facebook.fresco:animated-webp:1.11.+'
    //implementation 'com.facebook.fresco:webpsupport:1.3.0'

    // For WebP support, without animations
    implementation 'com.facebook.fresco:webpsupport:1.11.+'

    implementation 'com.android.support:multidex:1.0.1'

    implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
}

apply plugin: 'com.google.gms.google-services'

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.tootitoo.tootitoo"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <uses-sdk
        android:minSdkVersion="21"
        android:targetSdkVersion="26" />

    <application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:theme="@style/AppTheme">
<!--      android:name="android.support.multidex.MultiDexApplication"-->
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize"
        android:launchMode="singleTop">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <action android:name="android.intent.action.DOWNLOAD_COMPLETE"/>
        </intent-filter>
        <intent-filter android:autoVerify="true">
            <action android:name="android.intent.action.VIEW"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE"/>
            <data android:host="tootitoo.page.link" android:scheme="http"/>
            <data android:host="tootitoo.page.link" android:scheme="https"/>
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
      <activity android:name="com.twitter.sdk.android.core.identity.OAuthActivity" />
      <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
      <service android:name="io.invertase.firebase.messaging.RNFirebaseMessagingService">
          <intent-filter>
              <action android:name="com.google.firebase.MESSAGING_EVENT" />
          </intent-filter>
      </service>
      <service android:name="io.invertase.firebase.messaging.RNFirebaseInstanceIdService">
          <intent-filter>
              <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
          </intent-filter>
      </service>
      <service android:name="io.invertase.firebase.messaging.RNFirebaseBackgroundMessagingService" />
      <!-- Set custom default icon. This is used when no icon is set for incoming notification messages.
       See README(https://goo.gl/l4GJaQ) for more. -->
      <meta-data
      android:name="com.google.firebase.messaging.default_notification_icon"
      android:resource="@drawable/ic_stat_ic_notification" />
      <!-- Set color used with incoming notification messages. This is used when no color is set for the incoming
       notification message. See README(https://goo.gl/6BKBk7) for more. -->
      <meta-data
      android:name="com.google.firebase.messaging.default_notification_color"
      android:resource="@color/colorAccent" />
      <meta-data
       android:name="com.google.android.geo.API_KEY"
       android:value="AIzaSyC5CbrgPRkS6bL0Ef8Xb9TrWdTrYHkCFCo"/>

      <receiver android:name="io.invertase.firebase.notifications.RNFirebaseNotificationReceiver"/>
      <receiver android:enabled="true" android:exported="true"  android:name="io.invertase.firebase.notifications.RNFirebaseNotificationsRebootReceiver">
          <intent-filter>
              <action android:name="android.intent.action.BOOT_COMPLETED"/>
              <action android:name="android.intent.action.QUICKBOOT_POWERON"/>
              <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
              <category android:name="android.intent.category.DEFAULT" />
          </intent-filter>
      </receiver>
    </application>

</manifest>
kkusanagi commented 5 years ago

Just solve it. But still a problem too. You need to install Twitter app, in order to use the Twitter Sign In Feature.

If don't have Twitter app, it will crashed. Need find some way to override this issue.

jotilohana commented 8 months ago

@kkusanagi same issue did you find any solution?