我想在twitter上阅读用户时间表,因为我正在使用Fabric.On阅读官方文档进行应用程序身份验证我发现这种方法可以使用Fabric进行身份验证
TwitterAuthConfig authConfig = new TwitterAuthConfig(Constants.TWITTER_API_KEY, Constants.TWITTER_API_SECRET);
Fabric.with(this, new Twitter(authConfig));
并收到此错误
12-30 22:15:37.202 25440-25440/com.iifa.utsavam W/dalvikvm﹕ VFY: rejected Lcom/twitter/sdk/android/core/internal/TwitterSessionVerifier;.verifySession (Lcom/twitter/sdk/android/core/Session;)V
12-30 22:15:37.202 25440-25440/com.iifa.utsavam W/dalvikvm﹕ VFY: rejecting opcode 0x0d at 0x0017
12-30 22:15:37.202 25440-25440/com.iifa.utsavam W/dalvikvm﹕ VFY: rejected Lcom/twitter/sdk/android/core/internal/TwitterSessionVerifier;.verifySession (Lcom/twitter/sdk/android/core/Session;)V
12-30 22:15:37.202 25440-25440/com.iifa.utsavam W/dalvikvm﹕ Verifier rejected class Lcom/twitter/sdk/android/core/internal/TwitterSessionVerifier;
12-30 22:15:37.212 25440-25440/com.iifa.utsavam D/AndroidRuntime﹕ Shutting down VM
12-30 22:15:37.212 25440-25440/com.iifa.utsavam W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x418038b0)
java.lang.VerifyError: com/twitter/sdk/android/core/internal/TwitterSessionVerifier
at com.twitter.sdk.android.core.TwitterCore.onPreExecute(TwitterCore.java:126)
at io.fabric.sdk.android.InitializationTask.onPreExecute(InitializationTask.java:44)
at io.fabric.sdk.android.services.concurrency.AsyncTask.executeOnExecutor(AsyncTask.java:611)
at io.fabric.sdk.android.services.concurrency.PriorityAsyncTask.executeOnExecutor(PriorityAsyncTask.java:43)
at io.fabric.sdk.android.Kit.initialize(Kit.java:66)
at io.fabric.sdk.android.Fabric.initializeKits(Fabric.java:439)
at io.fabric.sdk.android.Fabric.init(Fabric.java:383)
at io.fabric.sdk.android.Fabric.setFabric(Fabric.java:340)
at io.fabric.sdk.android.Fabric.with(Fabric.java:311)
at com.iifa.utsavam.AuthActivity.onLoginSkip(AuthActivity.java:75)
at com.iifa.utsavam.AuthActivity_$1.onClick(AuthActivity_.java:93)
at android.view.View.performClick(View.java:4421)
at android.view.View$PerformClick.run(View.java:17904)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5214)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)
这些是我的成绩档案
buildscript {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'me.tatarka:gradle-retrolambda:3.2.1'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
我的应用程序是gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'android-apt'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.linux.tweener"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
apt 'org.androidannotations:androidannotations:3.2'
compile 'org.androidannotations:androidannotations-api:3.2'
compile 'com.android.support:design:23.1.1'
compile 'com.github.bmelnychuk:atv:1.2.7'
compile 'io.reactivex:rxandroid:0.24.0'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.makeramen:roundedimageview:1.5.0'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'com.squareup.retrofit:retrofit:1.8.0'
compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
compile('com.github.afollestad.material-dialogs:core:0.8.5.1@aar') {
transitive = true
}
// compile 'com.github.traex.rippleeffect:library:1.0.2'
compile 'com.pnikosis:materialish-progress:1.7'
compile 'com.github.citux:datetimepicker:0.2.0'
compile 'com.github.bmelnychuk:atv:1.2.7'
compile 'com.facebook.android:facebook-android-sdk:4.3.0'
compile('com.twitter.sdk.android:twitter:1.11.0@aar') {
transitive = true;
}
}
答案 0 :(得分:0)
For Use Fabric
TwitterAuthConfig authConfig = new TwitterAuthConfig(Constants.TWITTER_CONSUMER_KEY, Constants.TWITTER_CONSUMER_SECRET);
// For Simple Login:
Fabric.with(this, new Twitter(authConfig));
// For Simple Login as well as add crashlytics.
Fabric.with(this, new Twitter(authConfig), new Crashlytics());
// For Post Tweets
Fabric.with(this, new TwitterCore(authConfig), new TweetComposer());
你还需要在清单文件中添加权限
<meta-data
android:name="io.fabric.ApiKey"
android:value="--Add Your Key Here--" />
还要检查Build.gradle文件(app模块)
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
和构建依赖
// For Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.5.3@aar') {
transitive = true;
}
// For Twitter Login
compile('com.twitter.sdk.android:twitter:1.9.1@aar') {
transitive = true;
}
请遵循此。