我正在制作一个需要使用Twitter帐户登录的应用程序,每件事情都运行良好但是当我尝试以编程方式登录用户时它不起作用而且我是usinf fabric sdk。这个问题已被多次询问,但解决方案对我不起作用
我查了一下How to logout from twitter using Fabric Sdk for android
但问题是它需要使用一个函数Twitter.logOut()
,它会向我显示一条消息,它无法解析方法logOut()
,这意味着该方法不再可用
这是项目的格斗:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是app gradle:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 26
buildToolsVersion "28.0.0-rc1"
defaultConfig {
applicationId "arb.passwordmanager"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(':library')
implementation project(':jsoup-1.10.3')
implementation 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.android.support:appcompat-v7:26.0.0-alpha1'
implementation 'com.android.support:design:26.0.0-alpha1'
implementation 'com.android.support:support-v4:26.0.0-alpha1'
implementation 'com.android.support:support-vector-drawable:26.0.0-alpha1'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
// compile 'com.google.android.gms:play-services-appindexing:9.8.0'
implementation 'com.google.firebase:firebase-appindexing:12.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:recyclerview-v7:26.0.0-alpha1'
implementation 'com.android.support:cardview-v7:26.0.0-alpha1'
implementation 'com.android.support:palette-v7:26.0.0-alpha1'
implementation 'com.squareup.picasso:picasso:2.4.0'
implementation 'com.android.support:support-v13:26.0.0-alpha1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.facebook.android:facebook-android-sdk:4.31.0'
/*implementation('com.twitter.sdk.android:twitter-core:1.6.3@aar') {
transitive = true;
}*/
/*compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true
}*/
//implementation 'com.twitter.sdk.android:twitter-core:3.1.1'
implementation 'com.twitter.sdk.android:twitter:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
该方法的任何替代方案或可能有用的其他方式
答案 0 :(得分:0)
尝试使用以下代码删除Cookie。
CookieSyncManager.createInstance(activity.this);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie();