mapbox / mapbox/mapbox-plugins-android

Jetifier fails on Mapbox aars when attempting to migrate to AndroidX

Open
#1,060 3 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
242
Forks
116
PR merge metrics
No merged PRs in 30d

Description

### Steps to reproduce

1. Migrate existing working project to AndroidX
2. Build via gradle from command line.

### Expected behavior

Successful build

### Actual behavior

Errors thrown for each Mapbox aar as below. No errors on any other libraries.

````
> Could not resolve all files for configuration ':androidLib:debugCompileClasspath'.
> Failed to transform artifact 'mapbox-android-plugin-annotation-v8.aar (com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v8:0.7.0)' to match attributes {artifactType=android-aidl}.
> Execution failed for JetifyTransform: /Users/clyde/.gradle/caches/modules-2/files-2.1/com.mapbox.mapboxsdk/mapbox-android-plugin-annotation-v8/0.7.0/ad94f8386bc00f894c1c030b1188aec571e74533/mapbox-android-plugin-annotation-v8-0.7.0.aar.
> Failed to transform '/Users/clyde/.gradle/caches/modules-2/files-2.1/com.mapbox.mapboxsdk/mapbox-android-plugin-annotation-v8/0.7.0/ad94f8386bc00f894c1c030b1188aec571e74533/mapbox-android-plugin-annotation-v8-0.7.0.aar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)
> Failed to transform artifact 'mapbox-android-plugin-building-v8.aar (com.mapbox.mapboxsdk:mapbox-android-plugin-building-v8:0.6.0)' to match attributes {artifactType=android-aidl}.
> Execution failed for JetifyTransform: /Users/clyde/.gradle/caches/modules-2/files-2.1/com.mapbox.mapboxsdk/mapbox-android-plugin-building-v8/0.6.0/6c38df387e04b809466779f2299427fa78d0ac2c/mapbox-android-plugin-building-v8-0.6.0.aar.
> Failed to transform '/Users/clyde/.gradle/caches/modules-2/files-2.1/com.mapbox.mapboxsdk/mapbox-android-plugin-building-v8/0.6.0/6c38df387e04b809466779f2299427fa78d0ac2c/mapbox-android-plugin-building-v8-0.6.0.aar' using Jetifier. Reason: null. (Run with --stacktrace for more details.)
````

The stacktrace is not particularly informative:
````
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassVisitor.(ClassVisitor.java:79)
at org.objectweb.asm.commons.ClassRemapper.(ClassRemapper.java:61)
at org.objectweb.asm.commons.ClassRemapper.(ClassRemapper.java:56)
at com.android.tools.build.jetifier.processor.transform.bytecode.CoreRemapperImpl.(CoreRemapperImpl.kt:57)
at com.android.tools.build.jetifier.processor.transform.bytecode.ByteCodeTransformer.runTransform(ByteCodeTransformer.kt:38)
at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:443)
at com.android.tools.build.jetifier.processor.archive.ArchiveFile.accept(ArchiveFile.kt:49)
at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:425)
at com.android.tools.build.jetifier.processor.archive.Archive.accept(Archive.kt:76)
at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:425)
at com.android.tools.build.jetifier.processor.archive.Archive.accept(Archive.kt:76)
at com.android.tools.build.jetifier.processor.Processor.transformLibrary(Processor.kt:421)
at com.android.tools.build.jetifier.processor.Processor.transform(Processor.kt:247)
at com.android.build.gradle.internal.dependency.JetifyTransform.transform(JetifyTransform.kt:113)
````

### Configuration

**Mapbox SDK versions:** Android 8.4.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the AndroidX migration by building from the command line with the Mapbox plugin AARs, then inspect the JetifyTransform stack trace beginning at CoreRemapperImpl.kt:57 and ByteCodeTransformer.kt:38. Done means the project builds successfully without Jetifier errors for the Mapbox artifacts.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
build-system, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.