-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[URGENT] Fix NoSuchMethodException and fix broken twitter auth #396
[URGENT] Fix NoSuchMethodException and fix broken twitter auth #396
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amandle The NoSuchMethodException was Facebook's fault and wasn't caused by the support library because I got the crash in my app with 1.0.0 (which has support lib 24).
Another issue is that CCT doesn't work with Facebook, but in a really weird way. It will use a webview unless you do some weird stuff: 1. start Facebook auth flow 2. go back and start email flow 3. go back and start Facebook flow again to finally get Facebook to use CCT. I've spent over an hour trying to figure this out, but I don't get how starting the email flow is in any way related to facebook using CCT. Any help would be appreciated.
11-04 22:00:27.771 10981-10981/com.supercilex.robotscouter.debug E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.supercilex.robotscouter.debug, PID: 10981
java.lang.NoSuchMethodError: No virtual method launchUrl(Landroid/app/Activity;Landroid/net/Uri;)V in class Landroid/support/customtabs/CustomTabsIntent; or its super classes (declaration of 'android.support.customtabs.CustomTabsIntent' appears in /data/data/com.supercilex.robotscouter.debug/files/instant-run/dex/slice-com.android.support-customtabs-25.0.0_737ca989d52d015046ea92c6cd9cc551d6d9194c-classes.dex)
at com.facebook.internal.CustomTab.openCustomTab(CustomTab.java:47)
at com.facebook.login.CustomTabLoginMethodHandler.tryAuthorize(CustomTabLoginMethodHandler.java:92)
at com.facebook.login.LoginClient.tryCurrentHandler(LoginClient.java:258)
at com.facebook.login.LoginClient.tryNextHandler(LoginClient.java:220)
at com.facebook.login.LoginClient.authorize(LoginClient.java:128)
at com.facebook.login.LoginClient.startOrContinueAuth(LoginClient.java:109)
at com.facebook.login.LoginFragment.onResume(LoginFragment.java:176)
at android.support.v4.app.Fragment.performResume(Fragment.java:2133)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1156)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1277)
at android.support.v4.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:2164)
at android.support.v4.app.FragmentController.dispatchResume(FragmentController.java:223)
at android.support.v4.app.FragmentActivity.onResumeFragments(FragmentActivity.java:509)
at android.support.v4.app.FragmentActivity.onPostResume(FragmentActivity.java:498)
at android.app.Activity.performResume(Activity.java:6807)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3380)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3443)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2716)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1461)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6088)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
AND
11-04 22:03:00.183 18598-19670/com.supercilex.robotscouter.debug E/Fabric: Error dealing with settings
java.lang.IllegalArgumentException: Fabric could not be initialized, API key missing from AndroidManifest.xml. Add the following tag to your Application element
<meta-data android:name="io.fabric.ApiKey" android:value="YOUR_API_KEY"/>
at io.fabric.sdk.android.services.common.ApiKey.logErrorOrThrowException(ApiKey.java:110)
at io.fabric.sdk.android.services.common.ApiKey.getValue(ApiKey.java:61)
at io.fabric.sdk.android.services.settings.Settings.initialize(Settings.java:78)
at io.fabric.sdk.android.Onboarding.retrieveSettingsData(Onboarding.java:123)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:99)
at io.fabric.sdk.android.Onboarding.doInBackground(Onboarding.java:45)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:63)
at io.fabric.sdk.android.InitializationTask.doInBackground(InitializationTask.java:28)
at io.fabric.sdk.android.services.concurrency.AsyncTask$2.call(AsyncTask.java:311)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
AND
In com.supercilex.robotscouter.debug:1.0.0-DEBUG:1532.
* com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity has leaked:
* GC ROOT thread java.lang.Thread.<Java Local> (named 'Queue')
* references io.fabric.sdk.android.services.common.IdManager.appContext
* leaks com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity instance
* Retaining: 3.4 MB.
* Reference Key: 452dc2cb-dde0-4cc3-8d5a-8c88880a5bfd
* Device: Google google Pixel XL marlin
* Android Version: 7.1 API: 25 LeakCanary: 1.5 00f37f5
* Durations: watch=5145ms, gc=124ms, heap dump=13433ms, analysis=153384ms
* Details:
* Instance of java.lang.Thread
| static SUBCLASS_IMPLEMENTATION_PERMISSION = java.lang.RuntimePermission@1884810312 (0x7057ec48)
| static $classOverhead = byte[408]@1885645977 (0x7064ac99)
| static NANOS_PER_MILLI = 1000000
| static threadSeqNumber = 9907
| static MAX_PRIORITY = 10
| static EMPTY_STACK_TRACE = java.lang.StackTraceElement[0]@1884899072 (0x70594700)
| static threadInitNumber = 20
| static defaultUncaughtExceptionHandler = com.google.firebase.crash.internal.zzf@314577392 (0x12c011f0)
| static MIN_PRIORITY = 1
| static NORM_PRIORITY = 5
| blocker = null
| blockerLock = java.lang.Object@314604360 (0x12c07b48)
| contextClassLoader = dalvik.system.PathClassLoader@314855824 (0x12c45190)
| daemon = false
| eetop = 0
| group = java.lang.ThreadGroup@1884833576 (0x70584728)
| inheritableThreadLocals = null
| inheritedAccessControlContext = java.security.AccessControlContext@314604368 (0x12c07b50)
| lock = java.lang.Object@314601616 (0x12c07090)
| name = java.lang.String@314754144 (0x12c2c460)
| nativeParkEventPointer = 0
| nativePeer = 503307589120
| parkBlocker = java.util.concurrent.CountDownLatch$Sync@314585368 (0x12c03118)
| parkState = 3
| priority = 10
| single_step = false
| stackSize = 0
| started = true
| stillborn = false
| target = java.util.concurrent.ThreadPoolExecutor$Worker@314610304 (0x12c09280)
| threadLocalRandomProbe = 0
| threadLocalRandomSecondarySeed = 0
| threadLocalRandomSeed = 0
| threadLocals = java.lang.ThreadLocal$ThreadLocalMap@318117848 (0x12f617d8)
| threadQ = null
| threadStatus = 0
| tid = 9871
| uncaughtExceptionHandler = null
| shadow$_klass_ = java.lang.Thread
| shadow$_monitor_ = 0
* Instance of io.fabric.sdk.android.services.common.IdManager
| static COLLECT_DEVICE_IDENTIFIERS = java.lang.String@314665856 (0x12c16b80)
| static BAD_ANDROID_ID = java.lang.String@314764640 (0x12c2ed60)
| static FORWARD_SLASH_REGEX = java.lang.String@315781664 (0x12d27220)
| static COLLECT_USER_IDENTIFIERS = java.lang.String@314666432 (0x12c16dc0)
| static DEFAULT_VERSION_NAME = java.lang.String@1886380032 (0x706fe000)
| static $classOverhead = byte[284]@315594721 (0x12cf97e1)
| static PREFKEY_INSTALLATION_UUID = java.lang.String@314779896 (0x12c328f8)
| static ID_PATTERN = java.util.regex.Pattern@315775608 (0x12d25a78)
| advertisingInfo = null
| advertisingInfoProvider = io.fabric.sdk.android.services.common.AdvertisingInfoProvider@317172864 (0x12e7ac80)
| appContext = com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity@316098704 (0x12d74890)
| appIdentifier = java.lang.String@314813848 (0x12c3ad98)
| appInstallIdentifier = null
| collectHardwareIds = true
| collectUserIds = true
| fetchedAdvertisingInfo = false
| installationIdLock = java.util.concurrent.locks.ReentrantLock@317172880 (0x12e7ac90)
| installerPackageNameProvider = io.fabric.sdk.android.services.common.InstallerPackageNameProvider@317172896 (0x12e7aca0)
| kits = java.util.HashMap$Values@315683680 (0x12d0f360)
| shadow$_klass_ = io.fabric.sdk.android.services.common.IdManager
| shadow$_monitor_ = 0
* Instance of com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity
| static TAG = java.lang.String@314825744 (0x12c3dc10)
| static $classOverhead = byte[3988]@315863041 (0x12d3b001)
| static RC_ACCOUNT_LINK = 3
| static RC_EMAIL_FLOW = 2
| mIdpProviders = java.util.ArrayList@316472360 (0x12dcfc28)
| mSmartLock = com.firebase.ui.auth.util.SmartLock@315452400 (0x12cd6bf0)
| mActivityHelper = com.firebase.ui.auth.ui.ActivityHelper@316472384 (0x12dcfc40)
| mDelegate = android.support.v7.app.AppCompatDelegateImplN@316482032 (0x12dd21f0)
| mEatKeyUpEvent = false
| mResources = null
| mThemeId = 2131361946
| mCreated = true
| mFragments = android.support.v4.app.FragmentController@316320976 (0x12daacd0)
| mHandler = android.support.v4.app.FragmentActivity$1@316494880 (0x12dd5420)
| mMediaController = null
| mNextCandidateRequestIndex = 0
| mOptionsMenuInvalidated = false
| mPendingFragmentActivityResults = android.support.v4.util.SparseArrayCompat@316472408 (0x12dcfc58)
| mReallyStopped = true
| mRequestedPermissionsFromFragment = false
| mResumed = false
| mRetaining = false
| mStopped = true
| mStartedActivityFromFragment = false
| mStartedIntentSenderFromFragment = false
| mActionBar = null
| mActionModeTypeStarting = 0
| mActivityInfo = android.content.pm.ActivityInfo@316482176 (0x12dd2280)
| mActivityTransitionState = android.app.ActivityTransitionState@316485864 (0x12dd30e8)
| mApplication = com.supercilex.robotscouter.util.CanaryKiller@314944544 (0x12c5ac20)
| mCalled = true
| mChangeCanvasToTranslucent = false
| mChangingConfigurations = false
| mComponent = android.content.ComponentName@316320992 (0x12daace0)
| mConfigChangeFlags = 0
| mCurrentConfig = android.content.res.Configuration@316498064 (0x12dd6090)
| mDecor = null
| mDefaultKeyMode = 0
| mDefaultKeySsb = null
| mDestroyed = true
| mDoReportFullyDrawn = false
| mEatKeyUpEvent = false
| mEmbeddedID = null
| mEnableDefaultActionBarUp = false
| mEnterTransitionListener = android.app.SharedElementCallback$1@1892599224 (0x70cec5b8)
| mExitTransitionListener = android.app.SharedElementCallback$1@1892599224 (0x70cec5b8)
| mFinished = true
| mFragments = android.app.FragmentController@316321008 (0x12daacf0)
| mHandler = android.os.Handler@316494912 (0x12dd5440)
| mHasCurrentPermissionsRequest = false
| mIdent = 180446651
| mInstanceTracker = android.os.StrictMode$InstanceTracker@316321024 (0x12daad00)
| mInstrumentation = android.app.Instrumentation@315417792 (0x12cce4c0)
| mIntent = android.content.Intent@316485920 (0x12dd3120)
| mLastNonConfigurationInstances = null
| mMainThread = android.app.ActivityThread@314589440 (0x12c04100)
| mManagedCursors = java.util.ArrayList@316472432 (0x12dcfc70)
| mManagedDialogs = null
| mMenuInflater = null
| mParent = null
| mReferrer = java.lang.String@316442824 (0x12dc88c8)
| mResultCode = 0
| mResultData = null
| mResumed = false
| mSearchEvent = null
| mSearchManager = null
| mStartedActivity = false
| mStopped = true
| mTaskDescription = android.app.ActivityManager$TaskDescription@316494944 (0x12dd5460)
| mTemporaryPause = false
| mTitle = java.lang.String@315585488 (0x12cf73d0)
| mTitleColor = 0
| mTitleReady = true
| mToken = android.os.BinderProxy@316494976 (0x12dd5480)
| mTranslucentCallback = null
| mUiThread = java.lang.Thread@1971683160 (0x75857f58)
| mVisibleBehind = false
| mVisibleFromClient = true
| mVisibleFromServer = true
| mVoiceInteractor = null
| mWindow = com.android.internal.policy.PhoneWindow@316089248 (0x12d723a0)
| mWindowAdded = true
| mWindowManager = android.view.WindowManagerImpl@316472456 (0x12dcfc88)
| mInflater = com.android.internal.policy.PhoneLayoutInflater@316082448 (0x12d70910)
| mOverrideConfiguration = null
| mResources = android.content.res.Resources@316119488 (0x12d799c0)
| mTheme = android.content.res.Resources$Theme@316321040 (0x12daad10)
| mThemeResource = 2131361946
| mBase = android.app.ContextImpl@316450064 (0x12dca510)
| shadow$_klass_ = com.firebase.ui.auth.ui.idp.AuthMethodPickerActivity
| shadow$_monitor_ = 1073744196
* Excluded Refs:
| Field: android.view.Choreographer$FrameDisplayEventReceiver.mMessageQueue (always)
| Thread:FinalizerWatchdogDaemon (always)
| Thread:main (always)
| Thread:LeakCanary-Heap-Dump (always)
| Class:java.lang.ref.WeakReference (always)
| Class:java.lang.ref.SoftReference (always)
| Class:java.lang.ref.PhantomReference (always)
| Class:java.lang.ref.Finalizer (always)
| Class:java.lang.ref.FinalizerReference (always)
testCompile 'org.robolectric:robolectric:3.1.2' | ||
// See https://github.com/robolectric/robolectric/issues/1932#issuecomment-219796474 | ||
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1' | ||
|
||
compile 'com.facebook.android:facebook-android-sdk:4.14.1' | ||
compile("com.twitter.sdk.android:twitter:2.0.0@aar") { | ||
compile 'com.facebook.android:facebook-android-sdk:4.17.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the NoSuchMethodException
@@ -9,6 +9,9 @@ | |||
<meta-data | |||
android:name="com.google.android.gms.version" | |||
android:value="@integer/google_play_services_version" /> | |||
<meta-data | |||
android:name="io.fabric.ApiKey" | |||
android:value="@string/twitter_consumer_secret"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes broken twitter auth and huge 3.4mb leak because twitter has terrible error handling.
@SUPERCILEX I can't reproduce this NoSuchMethoException can I ask a few questions:
While I don't object to these changes, there seems to be something strange going on here. @amandle get a crash when using support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@samtstern I did some more research and figured out what's going on. I thought that gradle compiled different dependency versions for each library, but instead, it just upgrades those dependencies to the highest version mentioned throughout all dependencies. I was using support lib v25 which forced the facebook library to upgrade:
| | +--- com.facebook.android:facebook-android-sdk:4.14.1
| | | +--- com.parse.bolts:bolts-android:1.4.0
| | | | +--- com.parse.bolts:bolts-tasks:1.4.0
| | | | \--- com.parse.bolts:bolts-applinks:1.4.0
| | | | \--- com.parse.bolts:bolts-tasks:1.4.0
| | | +--- com.android.support:customtabs:23.4.0
| | | +--- com.android.support:support-v4:23.4.0 -> 25.0.0 (*)
| | | \--- com.android.support:cardview-v7:23.4.0
The demo app didn't crash because it was using support lib v24.
I still can't get CCT to work correctly, see the video below where I eventually get facebook to use CCT (it doesn't work with support lib v24 either): https://youtu.be/pcovdrZhszw
|
||
Firebase-UI-auth v1.0.0 is incompatible with the v25 support libraries. Please upgrade to v1.0.1 | ||
to use the latest version of the support libraries. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of this statement (assuming FirebaseUI v1.0.1 contains this PR).
@SUPERCILEX I am seeing some people with similar experiences around the internet: So it seems the main thing we need to do is update the Facebook dependency (as you did in this PR). I'd like @amandle to weigh in though since he dealt with the previous support library issue. |
Also can you confirm that if you dont enable custom tabs for Facebook (by not changing |
@samtstern I just checked and facebook uses the webview as expected without |
@SUPERCILEX ok phew. That de-escalates this from " |
@samtstern should I keep the note in the README? |
@SUPERCILEX I don't think it's necessary. We've had releases before with some bad bugs and we've stuck with documenting them in issues. This error does not seem world-breaking enough to warrant special treatment, although I appreciate the consideration. |
@samtstern Done. |
@samtstern @amandle Any idea when this will be merged? |
I found the root cause of the support library issue:
Facebook was using a different support library version for CCT. To fix that, this commit adds those libraries to force update them whenever we update the support libs on our side. |
@SUPERCILEX sorry for the delay, @amandle and I have been crazy busy lately. I am merging this now into |
Sounds good! I've been able get around it by overriding the Gradle dependencies and the manifest. |
No description provided.