[TIMOB-26056] Android: Not providing facebook app id crashes the app with 7.1.1.GA & hangs on splash with 7.3.0
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Open |
Resolution | Unresolved |
Affected Version/s | Release 7.1.1, Release 7.3.0 |
Fix Version/s | n/a |
Components | Android |
Labels | engTriage |
Reporter | Lokesh Choudhary |
Assignee | Lokesh Choudhary |
Created | 2018-05-18T22:10:14.000+0000 |
Updated | 2020-01-07T06:04:46.000+0000 |
Description
Android: Not providing facebook app id crashes the app with 7.1.1.GA & hangs on splash with 7.3.0
I have created this ticket in TIMOB as I was unsure if its an SDK or module issue. Please move it to the appropriate project as needed.
Steps to reproduce:
1. Create a default project for android. 2. Add facebook module to the project. 3. Build the app for device/emulator.Actual results:
1. *With SDK 7.1.1.GA :* The app crashes on launch.
[ERROR] : ZdummyApplication: Error invoking: facebook.TiFacebookModule.onAppCreate()
[DEBUG] : AndroidRuntime: Shutting down VM
[ERROR] : TiApplication: (main) [5,1600] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to create application com.app.zdummy.ZdummyApplication: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.; Titanium 7.1.1,2018/04/19 11:11,undefined
[ERROR] : TiApplication: java.lang.RuntimeException: Unable to create application com.app.zdummy.ZdummyApplication: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
[ERROR] : TiApplication: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4710)
[ERROR] : TiApplication: at android.app.ActivityThread.-wrap1(ActivityThread.java)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:148)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5417)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
[ERROR] : TiApplication: Caused by: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
[ERROR] : TiApplication: at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:275)
[ERROR] : TiApplication: at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:231)
[ERROR] : TiApplication: at facebook.TiFacebookModule.onAppCreate(TiFacebookModule.java:163)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] : TiApplication: at com.app.zdummy.ZdummyApplication.onCreate(ZdummyApplication.java:227)
[ERROR] : TiApplication: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
[ERROR] : TiApplication: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
[ERROR] : TiApplication: ... 8 more
2. *With SDK 7.3.0 :*
The app hangs on splash.
[INFO] : FacebookInitProvider: A valid Facebook app id must be set in the AndroidManifest.xml or set by calling FacebookSdk.setApplicationId before initializing the sdk.
[INFO] : FacebookInitProvider: at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:275)
[INFO] : FacebookInitProvider: at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:231)
[INFO] : FacebookInitProvider: at com.facebook.internal.FacebookInitProvider.onCreate(FacebookInitProvider.java:20)
[INFO] : FacebookInitProvider: at android.content.ContentProvider.attachInfo(ContentProvider.java:1748)
[INFO] : FacebookInitProvider: at android.content.ContentProvider.attachInfo(ContentProvider.java:1723)
[INFO] : FacebookInitProvider: at android.app.ActivityThread.installProvider(ActivityThread.java:5153)
[INFO] : FacebookInitProvider: at android.app.ActivityThread.installContentProviders(ActivityThread.java:4748)
[INFO] : FacebookInitProvider: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4688)
[INFO] : FacebookInitProvider: at android.app.ActivityThread.-wrap1(ActivityThread.java)
[INFO] : FacebookInitProvider: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
[INFO] : FacebookInitProvider: at android.os.Handler.dispatchMessage(Handler.java:102)
[INFO] : FacebookInitProvider: at android.os.Looper.loop(Looper.java:148)
[INFO] : FacebookInitProvider: at android.app.ActivityThread.main(ActivityThread.java:5417)
[INFO] : FacebookInitProvider: at java.lang.reflect.Method.invoke(Native Method)
[INFO] : FacebookInitProvider: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
[INFO] : FacebookInitProvider: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
[WARN] : TiAndroid: (main) [1416,1514] Application instance no longer available. Unable to get current activity.
[WARN] : TiAndroid: (main) [1,1515] Application instance no longer available. Unable to get current activity.
[WARN] : TiAndroid: (main) [0,1515] Application instance no longer available. Unable to get current activity.
[INFO] : TiApplication: (main) [31,1546] Titanium Javascript runtime: v8
[DEBUG] : TouchtestmoduleModule: (main) [6,1552] inside onAppCreate
[DEBUG] : CrittercismAndroidModule: (main) [1,1553] App context is defined.
[ERROR] : ZdummyApplication: Error invoking: facebook.TiFacebookModule.onAppCreate()
[DEBUG] : AndroidRuntime: Shutting down VM
[ERROR] : TiApplication: (main) [3,1556] No valid root or current activity found for application instance
[INFO] : art: Starting a blocking GC HeapTrim
3. Both the cases appear to be the same but behave in a different way.
[~lchoudhary], the facebook library will throw an exception (and crash the app) if the app id is missing. This is by Facebook's design. They made it this way on purpose. You can see the facebook error message in the log. I'm pretty sure the behavior has always been this way. However, I am concerned about the hang on startup in 7.3.0. That's a new issue which I don't think is facebook related.
It's not a Titanium issue. Facebook is intentionally crashing the app with an exception. It's by their design. The error can be seen in the log regarding the missing app id.