Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2476] Facebook module crashes on Android Pie

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsFacebook
Labelsn/a
Reportergrebulon
AssigneeUnknown
Created2018-10-09T09:29:02.000+0000
Updated2018-12-04T23:51:47.000+0000

Description

Facebook SDK depends on org.apache.commons.codec and other apache stuff.
10-08 18:08:13.142: E/AndroidRuntime(9016): java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/codec/BinaryEncoder;
10-08 18:08:13.142: E/AndroidRuntime(9016):     at org.apache.commons.codec.digest.DigestUtils.shaHex(DigestUtils.java:150)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at org.appcelerator.titanium.util.TiResponseCache.get(TiResponseCache.java:327)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.CacheAdapter.getJavaCachedResponse(CacheAdapter.java:103)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.CacheAdapter.get(CacheAdapter.java:47)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:207)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:407)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:538)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:26)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphResponse.fromHttpConnection(GraphResponse.java:258)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphRequest.executeConnectionAndWait(GraphRequest.java:1267)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1165)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1131)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphRequest.executeBatchAndWait(GraphRequest.java:1115)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:1090)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.GraphRequest.executeAndWait(GraphRequest.java:984)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.internal.FetchedAppSettingsManager.getAppSettingsQueryResponse(FetchedAppSettingsManager.java:363)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.internal.FetchedAppSettingsManager.access$100(FetchedAppSettingsManager.java:60)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at com.facebook.internal.FetchedAppSettingsManager$1.run(FetchedAppSettingsManager.java:174)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
10-08 18:08:13.142: E/AndroidRuntime(9016):     at java.lang.Thread.run(Thread.java:764)

Comments

  1. Joshua Quick 2018-10-09

    This error will only happen if your app "targets" API Level 28 (aka: Android P), which Titanium does *not* support yet. Please see [link](https://docs.appcelerator.com/platform/latest/#!/guide/Titanium_Compatibility_Matrix-section-src-29004837_safe-id-VGl0YW5pdW1Db21wYXRpYmlsaXR5TWF0cml4LUFuZHJvaWRTREsvVGFyZ2V0QW5kcm9pZHBsYXRmb3Jt). Titanium apps which target API Level 27 (the default for Titanium 7.3.0-7.4.1) are backward compatible on Android P and run fine. I recommend that you *+remove+* the following from your "tiapp.xml"...
       <ti:app xmlns:ti="http://ti.appcelerator.org">
       	<android xmlns:android="http://schemas.android.com/apk/res/android">
       		<manifest>
       			<!-- Titanium does not support targeting 28 yet. We recommend 27 instead. -->
       			<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
       		</manifest>
       	</android>
       </ti:app>
       
  2. Sharif AbuDarda 2018-10-14

    Hello [~buddyguards], Did you follow Joshua's guide. Is the issue still there after targeting API level 27 instead of 28? Let us know. Thanks.
  3. grebulon 2018-10-15

    I need to target 28. I added the apache libraries to the module to work around this.
  4. Joshua Quick 2018-10-15

    You're free to target API Level 28 at your own risk, but just note that doing so introduces breaking changes. https://developer.android.com/about/versions/pie/android-9.0-changes-all What you got burned by is Google's removal of some Apache libraries. This doesn't just impact HTTP communications. It impacts MD5/SHA hashing functions too. https://developer.android.com/about/versions/pie/android-9.0-changes-all#apache-nonp We plan on supporting targeting API Level 28 in Titanium 7.5.0. This involves resolving the following Android P breaking-changes listed below. Personally, I don't recommend that you don't target API Level 28 yet, but if you have to, then you'll have to be concerned with the below.. * [TIMOB-26377] * [TIMOB-26297] * [TIMOB-26376] * [TIMOB-26260]

JSON Source