DIT112-V20 / group-04

MIT License
2 stars 5 forks source link

Newly added dialogflow related dependencies cause gradle build failure #65

Closed chrytsa closed 4 years ago

chrytsa commented 4 years ago

Description:

After introducing the DialogFlow implementation and while creating the respective pull request (#62) an unexpected fail in the build process was found. Despite the build failure in travis, the Android application is working completely fine. That was the reason of not noticing anything wrong in the first place.

Actions taken so far:

After looking at the stacktrace printed both locally and in the respective travis build, some dependancy that was introduced caused the main build issues. Also, the absence of the DialogFlow access key file was causing a problem as well, but was fixed in #64. However, until a final fix for the dependancies, a temporary workaround was introduced in #64 by skipping the lint error checking with the following script:

android {
      lintOptions {
          abortOnError false
      }
  }

Expected behaviour:

The build process should proceed without any errors.

chrytsa commented 4 years ago

Related gradle build stacktrace after the aforementioned failure:

Error: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]

Error: httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]

Error: Invalid package reference in org.apache.httpcomponents:httpclient; not included in Android: javax.naming.directory. Referenced from org.apache.http.conn.ssl.DefaultHostnameVerifier. [InvalidPackage]

chrytsa commented 4 years ago

Apparently the problem was caused by the added dependancy for DialogFlow API in build.gradle file, due to the fact that some already implemented libraries in Android are also implemented through that dependancy, therefore causing conflicts.

After tracking down the respective libraries found that by excluding both the httpclient and the commons-logging modules from the respective DialogFlow implementation com.google.cloud:google-cloud-dialogflow:2.0.0 fixes the conflicts.