Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-28149

Android: App builds fail if it includes "Java-WebSocket" library

    Details

    • Story Points:
      3
    • Sprint:
      2020 Sprint 19

      Description

      Summary:
      If an app includes the "Java-WebSocket" library via gradle (or a module that references it via gradle), then it will fail to build.

      Steps to reproduce:

      1. Create a "Classic" Titanium app project.
      2. Add the below "build.gradle" to project folder: ./platform/android
      3. Build for Android.

      ./platform/android/build.gradle

      dependencies {
      	implementation 'org.java-websocket:Java-WebSocket:1.5.1'
      }
      

      Result:
      The following build failure will occur...

      [ERROR] [GRADLE]   java.lang.RuntimeException: Duplicate class org.java_websocket.AbstractWebSocket found in modules jetified-Java-WebSocket-1.5.1.jar (org.java-websocket:Java-WebSocket:1.5.1) and jetified-titanium-9.2.0-runtime.jar (org.appcelerator:titanium:9.2.0)
      

      Cause:
      Titanium builds with a local "java_websocket.jar" below. It's used by V8 for debugging. We need to remove th JAR and instead reference the library via gradle.
      https://github.com/appcelerator/titanium_mobile/tree/master/android/runtime/v8/lib

      Work-Around:
      Add the following "build.gradle" to the app project's ./platform/android folder. It will exclude websocket library references from the gradle build to avoid collision with Titanium's local JAR. Although, once we fix this issue, you'll need to remove the below.

      configurations {
      	all {
      		exclude group: 'org.java-websocket', module: 'Java-WebSocket'
      	}
      }
      

        Attachments

          Activity

            People

            • Assignee:
              jquick Joshua Quick
              Reporter:
              hknoechel Hans Knöchel
              Reviewer:
              Gary Mathews
              Tester:
              Sohail Saddique
            • Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Integration