Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-20434] Kitchen Sink Crashes on initial install

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2016-02-20T06:12:50.000+0000
Affected Version/sRelease 5.2.0
Fix Version/sRelease 5.2.0
ComponentsAndroid
Labelsqe-5.2.0
ReporterJosh Longton
AssigneeAshraf Abu
Created2016-02-20T00:56:34.000+0000
Updated2016-02-22T01:58:18.000+0000

Description

*Description* When installing a fresh version of the kitchen sink from the stable branch on github, The first install on the phone crashes, if you change the SDK to the 5.1.2 GA and run it works. if you change the Facebook module to the 4.0.5 and run it works. After either of these it also works on 5.2.0.v20160219124528 SDK aswell *{color:red}This is a Regression.{color}* *Steps to reproduce:*

Download a fresh install of the stable kitchen sink

Change targetSdkVersion to 23

add Android config code below to the tiapp.xml

Run the application with the 5.2.0.v20160219124528 SDK and 5.0.0 Facebook module

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application>
                <activity android:alwaysRetainTaskState="true"
                    android:configChanges="keyboardHidden|orientation"
                    android:label="KitchenSink"
                    android:name=".KitchensinkActivity" android:theme="@style/Theme.Titanium">
                    <intent-filter>
                        <action android:name="android.intent.action.MAIN"/>
                        <category android:name="android.intent.category.LAUNCHER"/>
                    </intent-filter>
                </activity>
                <activity
                    android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
                    android:label="KitchenSinkFacebook"
                    android:name="com.facebook.FacebookActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
                <activity android:label="KitchenSinkFacebook"
                    android:name="com.facebook.LoginActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
                <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id"/>
            </application>
            <uses-sdk android:targetSdkVersion="23"/>
        </manifest>
        <activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity"/>
        <services>
            <service type="interval" url="testservice.js"/>
        </services>
    </android>
*Actual :* The application crashes *Log*
-- Start application log -----------------------------------------------------
[INFO] :   TiApplication: (main) [0,0] checkpoint, app created.
[INFO] :   TiApplication: (main) [51,51] Titanium 5.2.0 (2016/02/19 12:45 fd837d1)
[INFO] :   DatabaseHelper: No value in database for platform key: 'unique_machine_id' returning supplied default ''
[INFO] :   DatabaseHelper: No value in database for platform key: 'hardware_machine_id' returning supplied default ''
[INFO] :   TiApplication: (main) [201,252] Titanium Javascript runtime: v8
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[ERROR] :  TiApplication: (AsyncTask #1) [24,24] Sending event: exception on thread: AsyncTask #1 msg:java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference; Titanium 5.2.0,2016/02/19 12:45,fd837d1
[ERROR] :  TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.util.TiFileHelper2.hasStoragePermission(TiFileHelper2.java:89)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.util.TiResponseCache.get(TiResponseCache.java:314)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.CacheAdapter.getJavaCachedResponse(CacheAdapter.java:103)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.CacheAdapter.get(CacheAdapter.java:47)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:229)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:437)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:388)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:501)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
[ERROR] :  TiApplication: 	at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java)
[ERROR] :  TiApplication: 	at com.facebook.GraphResponse.fromHttpConnection(GraphResponse.java:253)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeConnectionAndWait(GraphRequest.java:1255)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1157)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1124)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1108)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:1083)
[ERROR] :  TiApplication: 	at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:977)
[ERROR] :  TiApplication: 	at com.facebook.internal.Utility.getAppSettingsQueryResponse(Utility.java:868)
[ERROR] :  TiApplication: 	at com.facebook.internal.Utility.access$1(Utility.java:860)
[ERROR] :  TiApplication: 	at com.facebook.internal.Utility$1.run(Utility.java:797)
[ERROR] :  TiApplication: 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
[ERROR] :  TiApplication: 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
[ERROR] :  TiApplication: 	at java.lang.Thread.run(Thread.java:818)
[INFO] :   SQLiteConnectionPool: The connection pool for /data/user/0/com.appcelerator.kitchensink/databases/appcAnalytics.db has been closed but there are still 1 connections in use.  They will be closed as they are released back to the pool.
[INFO] :   SQLiteConnectionPool: The connection pool for /data/user/0/com.appcelerator.kitchensink/databases/appcAnalytics.db has been closed but there are still 1 connections in use.  They will be closed as they are released back to the pool.
[ERROR] :  TiApplication: (main) [38,62] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appcelerator.kitchensink/com.appcelerator.kitchensink.KitchensinkActivity}: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.; Titanium 5.2.0,2016/02/19 12:45,fd837d1
[ERROR] :  TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.appcelerator.kitchensink/com.appcelerator.kitchensink.KitchensinkActivity}: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
[ERROR] :  TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
[ERROR] :  TiApplication: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
[ERROR] :  TiApplication: 	at android.app.ActivityThread.-wrap11(ActivityThread.java)
[ERROR] :  TiApplication: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
[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: java.lang.IllegalStateException: Cannot perform this operation because the connection pool has been closed.
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteConnectionPool.throwIfClosedLocked(SQLiteConnectionPool.java:962)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:677)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:348)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:894)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:834)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
[ERROR] :  TiApplication: 	at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
[ERROR] :  TiApplication: 	at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:219)
[ERROR] :  TiApplication: 	at android.database.AbstractCursor.moveToNext(AbstractCursor.java:268)
[ERROR] :  TiApplication: 	at com.appcelerator.analytics.APSAnalyticsModel.getProps(APSAnalyticsModel.java:307)
[ERROR] :  TiApplication: 	at com.appcelerator.analytics.APSAnalyticsModel.addEvent(APSAnalyticsModel.java:78)
[ERROR] :  TiApplication: 	at com.appcelerator.analytics.APSAnalyticsHelper.sendAnalyticsEvent(APSAnalyticsHelper.java:523)
[ERROR] :  TiApplication: 	at com.appcelerator.analytics.APSAnalyticsHelper.postAnalyticsEvent(APSAnalyticsHelper.java:479)
[ERROR] :  TiApplication: 	at com.appcelerator.analytics.APSAnalytics.sendAppEnrollEvent(APSAnalytics.java:121)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiApplication.setRootActivity(TiApplication.java:498)
[ERROR] :  TiApplication: 	at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:94)
[ERROR] :  TiApplication: 	at android.app.Activity.performCreate(Activity.java:6251)
[ERROR] :  TiApplication: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
[ERROR] :  TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
[WARN] :   V8Object: (KrollRuntimeThread) [19,81] Runtime disposed, cannot set property 'userAgent'
[INFO] :   Process: Sending signal. PID: 11338 SIG: 9
*GA :* The application runs *Expected:* The application runs

Comments

  1. Ashraf Abu 2016-02-20

    Issue as seen in logcat:-
       [ERROR] :  TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.app.Activity.checkSelfPermission(java.lang.String)' on a null object reference
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.util.TiFileHelper2.hasStoragePermission(TiFileHelper2.java:89)
       [ERROR] :  TiApplication: 	at org.appcelerator.titanium.util.TiResponseCache.get(TiResponseCache.java:314)
       
    Permission check is being done on an activity that is null at that point of initial creation. This was introduced here https://github.com/appcelerator/titanium_mobile/pull/7692 from TIMOB-20251 PR for fix into 5_2_X : https://github.com/appcelerator/titanium_mobile/pull/7761
  2. Ashraf Abu 2016-02-20

    This issue only affects Android 6.0 and above.
  3. Ashraf Abu 2016-02-20

    PR Merged in 5_2_X
  4. Wilson Luu 2016-02-22

    Closing ticket as fixed. Verified that KitchenSink does not crash on initial launch with Facebook module 5.0.0. Tested on: Appcelerator Studio, build: 4.5.0.201602170821 Appc CLI NPM: 4.2.3-2 Appc CLI Core: 5.2.0-269 Arrow: 1.7.27 SDK: 5.2.0.v20160220080449 Node: v4.2.4 OS: El Capitan (10.11.3) Device: Nexus 6 (6.0)
  5. Ashraf Abu 2016-02-22

    Master PR: https://github.com/appcelerator/titanium_mobile/pull/7765

JSON Source