Hello. I tried to follow your instruction, but i have this fail.
I only want to show some tweets in this app.
My TimelineActivity.java
package com.twitter.twitterdev;
import android.app.ListActivity;
import android.os.Bundle;
import android.util.Log;
import com.twitter.sdk.android.core.DefaultLogger;
import com.twitter.sdk.android.core.Twitter;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.twitter.sdk.android.core.TwitterConfig;
import com.twitter.sdk.android.tweetui.TweetTimelineListAdapter;
import com.twitter.sdk.android.tweetui.UserTimeline;
public class TimelineActivity extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.timeline);
TwitterConfig config = new TwitterConfig.Builder(this)
.logger(new DefaultLogger(Log.DEBUG))
.twitterAuthConfig(new TwitterAuthConfig("NhPW4nFKrQc0XcHB1zvqoSbnS", "Qx7pUo07XLauQ5yfHefgrjq748iFG1XFBGCVjB3YXtogCaMkMx"))
.debug(true)
.build();
Twitter.initialize(config);
final UserTimeline userTimeline = new UserTimeline.Builder()
.screenName("Cofan11")
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(this)
.setTimeline(userTimeline)
.build();
setListAdapter(adapter);
}
}
My timeline.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal|center_vertical"
android:text="No Tweets"/>
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="#e1e8ed"
android:dividerHeight="1dp"
android:drawSelectorOnTop="false"/>
My build.gragle
apply plugin: ‘com.android.application’
android {
compileSdkVersion 26
defaultConfig {
applicationId “com.twitter.twitterdev”
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName “1.0”
testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
}
}
dependencies {
implementation fileTree(dir: ‘libs’, include: [’*.jar’])
//noinspection GradleCompatible
implementation ‘com.android.support:appcompat-v7:26.0.0’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’
implementation ‘com.twitter.sdk.android:twitter-core:3.1.1’
implementation ‘com.twitter.sdk.android:tweet-ui:3.1.1’
implementation ‘com.twitter.sdk.android:tweet-composer:3.1.1’
implementation ‘com.twitter.sdk.android:twitter-mopub:3.1.1’
implementation ‘com.twitter.sdk.android:twitter:3.1.1’
implementation ‘com.android.support:support-v4:26.0.0’
implementation ‘com.android.support:support-annotations:26.0.0’
}
I just have “No tweets” and in logs
07/20 18:54:17: Launching app
$ adb install-multiple -r -t -p com.twitter.twitterdev A:\Twit\app\build\intermediates\split-apk\debug\slices\slice_0.apk
Split APKs installed
$ adb shell am start -n “com.twitter.twitterdev/com.twitter.twitterdev.TimelineActivity” -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet…Waiting for process to come online
Connected to process 14175 on device emulator-5554
Capturing and displaying logcat messages from application. This behavior can be disabled in the “Logcat output” section of the “Debugger” settings page.
W/tter.twitterde: JIT profile information will not be recorded: profile file does not exits.
I/chatty: uid=10090(com.twitter.twitterdev) identical 10 lines
W/tter.twitterde: JIT profile information will not be recorded: profile file does not exits.
I/InstantRun: starting instant run server: is main process
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/Settings: Setting airplane_mode_on has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
D/Twitter: Could not get parcel from Google Play Service to capture AdvertisingId
D/Twitter: Could not get parcel from Google Play Service to capture Advertising limitAdTracking
D/Twitter: AdvertisingInfo not present
W/tter.twitterde: Accessing hidden field Lsun/misc/Unsafe;->theUnsafe:Lsun/misc/Unsafe; (light greylist, reflection)
D/GuestSessionProvider: Refreshing expired guest session.
D/OpenGLRenderer: Skia GL Pipeline
D/: HostConnection::get() New Host Connection established 0xcb055680, tid 14226
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without…
D/OpenGLRenderer: Swap behavior 0
D/EGL_emulation: eglCreateContext: 0xdfc057e0: maj 3 min 1 rcv 4
D/EGL_emulation: eglMakeCurrent: 0xdfc057e0: ver 3 1 (tinfo 0xdfc03410)
E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
glUtilsParamSize: unknow param 0x000082da
D/EGL_emulation: eglMakeCurrent: 0xdfc057e0: ver 3 1 (tinfo 0xdfc03410)
V/StudioProfiler: StudioProfilers agent attached.
V/StudioProfiler: Acquiring Application for Events
V/StudioProfiler: Transformed class: java/net/URL
V/StudioProfiler: Transformed class: okhttp3/OkHttpClient
W/tter.twitterde: Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
Current dex file has more than one class in it. Calling RetransformClasses on this class might fail if no transformations are applied to it!
V/StudioProfiler: Memory control stream started.
V/StudioProfiler: Live memory tracking disabled.
V/StudioProfiler: Live memory tracking enabled.
JNIEnv not attached
V/StudioProfiler: Loaded classes: 11356
V/StudioProfiler: Tracking initialization took: 1071262500ns
E/Twitter: Failed to get app auth token
W/tter.twitterde: Long monitor contention with owner OkHttp https://api.twitter.com/… (14224) at void java.lang.Object.wait(long, int)(Object.java:-2) waiters=0 in com.twitter.sdk.android.core.GuestSession com.twitter.sdk.android.core.GuestSessionProvider.getCurrentSession() for 39.970s
D/GuestSessionProvider: Refreshing expired guest session.
W/twitter.com/…: type=1400 audit(0.0:88): avc: denied { write } for name=“perfd” dev=“dm-0” ino=36711 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
E/Twitter: Failed to get app auth token
W/scribe1: type=1400 audit(0.0:90): avc: denied { write } for name=“perfd” dev=“dm-0” ino=36711 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
W/scribe1: type=1400 audit(0.0:91): avc: denied { write } for name=“perfd” dev=“dm-0” ino=36711 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
D/GuestSessionProvider: Refreshing expired guest session.
W/twitter.com/…: type=1400 audit(0.0:92): avc: denied { write } for name=“perfd” dev=“dm-0” ino=36711 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
W/twitter.com/…: type=1400 audit(0.0:93): avc: denied { write } for name=“perfd” dev=“dm-0” ino=36711 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
E/Twitter: Failed to get app auth token
D/GuestSessionProvider: Refreshing expired guest session.
W/twitter.com/…: type=1400 audit(0.0:94): avc: denied { write } for name=“perfd” dev=“dm-0” ino=36711 scontext=u:r:untrusted_app_27:s0:c512,c768 tcontext=u:object_r:shell_data_file:s0 tclass=dir permissive=0
E/Twitter: Failed to get app auth token
What’s wrong? Or mb you will send me link in github with app.
Thank you!