6

I have set up a pipeline that runs my tests in microsoft azure pipelines. On my local machine this works fine and the jetified-libidpmobile-debug.jar file is found in the gradle system directory on my machine:

/Users/jimclermonts/.gradle/caches/transforms-2/files-2.1/efad9765ab457848824459e0c76abddc/jetified-libidpmobile-debug.jar

this is my build.gradle:

debugImplementation files('libs/libidpmobile-debug.jar')

From what I understand, jetified-libidpmobile-debug.jar is automatically created by jetifier from the libidpmobile-debug.jar file.

Output:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> Could not resolve all files for configuration ':app:_classStructurekaptDebugKotlin'.
   > Failed to transform file 'jetified-libidpmobile-debug.jar' to match attributes {artifactType=class-structure, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}
      > Execution failed for StructureArtifactTransform: /Users/iosadmin/.gradle/caches/transforms-2/files-2.1/1e14bb7ec832a0c2c967e6c977ddd9b9/jetified-libidpmobile-debug.jar.
         > error in opening zip file

Here is the part of my azure-pipelines.yml that assembles the debug and tests the unit tests:

trigger:
- master

pool:
  name: Mobile-Pool

steps:
- task: Gradle@2
  inputs:
    workingDirectory: ''
    gradleWrapperFile: 'gradlew'
    gradleOptions: '-Xmx4096m'
    publishJUnitResults: false
    testResultsFiles: '**/TEST-*.xml'
    tasks: 'assembleDebug testDebugUnitTest'

I tried the solutions in this post, this post and this post with no result. The jar file is 4mb big and is the only file that is in the code repository instead of some maven repository.

Updated Gradle to the latest:

classpath 'com.android.tools.build:gradle:4.0.0-beta05'
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Tried to edit the androidmanifest like this:

tools:replace="android:appComponentFactory"
android:appComponentFactory="androidx.core.app.CoreComponentFactory">

build.gradle:

kotlinOptions {
    jvmTarget = '1.8'
}

compileOptions {
    targetCompatibility JavaVersion.VERSION_1_8
    sourceCompatibility JavaVersion.VERSION_1_8
}
Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94

2 Answers2

1

I used jetifier-standalone to jetify the files. Added it to gradle.properties:

android.jetifier.blacklist = libidpmobile

and now it works.

Jim Clermonts
  • 1,694
  • 8
  • 39
  • 94
0

It looks like the databinding issue from the error The following options were not recognized by any processor: '[android.databinding.minApi....

You can try adding below line to build.gradle file.

kapt "com.android.databinding:compiler:$gradle_version"

You can check out below similar threads for more information:

Android Databinding build fail after Gradle plugin update with migration to annotationProcessor

Fail make project if android data binding enabled

Hope above helps!

Levi Lu-MSFT
  • 27,483
  • 2
  • 31
  • 43
  • I already have this: dataBinding { enabled = true } I think the problem is with jetifying certain jar files. And this is not succeeding on the CI, but on my local machine it works fine. – Jim Clermonts May 28 '20 at 08:20
  • I see now that the error message has changed. But not after adding the databinding library. – Jim Clermonts May 28 '20 at 08:54
  • Could it be because the java jdk used in cloud agent is different with your local machine? You can try setting the `jdkVersionOption` for gradle task to make sure the environment in the clould agent is the same with your local machine. – Levi Lu-MSFT Jun 04 '20 at 09:30
  • Java 1.8 is used – Jim Clermonts Jul 08 '20 at 15:31