Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: annotation processors need to be updated manually to add support for androidx error

After enabling data binding by adding the following to build.gradle file in the app module:

android {
    ...
    dataBinding {
        enabled = true
    }
}

I see this error upon building my app:

The given artifact contains a string literal with a package reference 'android/support/v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.

I have scoured the internet to solve the problem but no luck.

More detailed log:

org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures.
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:358)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.runTasks(DefaultGradleLauncher.java:219)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:124)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:77)
    at org.gradle.internal.invocation.GradleBuildController$1.call(GradleBuildController.java:74)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:154)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:38)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:96)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:74)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:55)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.run(RunAsBuildOperationBuildActionRunner.java:50)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:45)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:47)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:44)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:79)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:44)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:62)
    at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:34)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:31)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:46)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptGenerateStubsFossDebugKotlin'.
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:49)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101)
    at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44)
    at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91)
    at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.run(EventFiringTaskExecuter.java:51)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:300)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:292)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:174)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:46)
    at org.gradle.execution.taskgraph.LocalTaskInfoExecutor.execute(LocalTaskInfoExecutor.java:42)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:277)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareWorkItemExecutor.execute(DefaultTaskExecutionGraph.java:262)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:135)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.execute(DefaultTaskPlanExecutor.java:200)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.executeWithWork(DefaultTaskPlanExecutor.java:191)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$ExecutorWorker.run(DefaultTaskPlanExecutor.java:130)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:74)
    at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph.execute(DefaultTaskExecutionGraph.java:143)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:40)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:24)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:46)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:49)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:40)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:33)
    at org.gradle.initialization.DefaultGradleLauncher$ExecuteTasks.run(DefaultGradleLauncher.java:355)
    ... 77 more
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:kapt'.
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.rethrowFailure(DefaultConfiguration.java:1054)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.access$1700(DefaultConfiguration.java:123)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1028)
    at org.gradle.api.internal.file.AbstractFileCollection.iterator(AbstractFileCollection.java:76)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration.iterator(DefaultConfiguration.java:439)
    at org.gradle.api.internal.file.CompositeFileCollection.iterator(CompositeFileCollection.java:65)
    at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt$withWrappedKaptOptions$1.apply(subpluginUtils.kt:71)
    at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt$withWrappedKaptOptions$1.apply(subpluginUtils.kt)
    at java.util.HashMap.compute(HashMap.java:1196)
    at org.jetbrains.kotlin.gradle.internal.SubpluginUtilsKt.withWrappedKaptOptions(subpluginUtils.kt:50)
    at org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask.setupCompilerArgs(KaptGenerateStubsTask.kt:73)
    at org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask.setupCompilerArgs(KaptGenerateStubsTask.kt:36)
    at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware$DefaultImpls.setupCompilerArgs$default(CompilerArgumentAware.kt:37)
    at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareKt.prepareCompilerArguments(CompilerArgumentAware.kt:41)
    at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware$DefaultImpls.getFilteredArgumentsMap(CompilerArgumentAware.kt:34)
    at org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareWithInput$DefaultImpls.getFilteredArgumentsMap(CompilerArgumentAware.kt:54)
    at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompileTool.getFilteredArgumentsMap(Tasks.kt:49)
    at org.jetbrains.kotlin.gradle.internal.KaptGenerateStubsTask_Decorated.getFilteredArgumentsMap(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor1732.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$DefaultPropertyValue$1$1.create(AbstractNestedRuntimeBeanNode.java:83)
    at org.gradle.util.SingleMessageLogger.whileDisabled(SingleMessageLogger.java:313)
    at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$DefaultPropertyValue$1.get(AbstractNestedRuntimeBeanNode.java:80)
    at com.google.common.base.Suppliers$MemoizingSupplier.get(Suppliers.java:125)
    at org.gradle.api.internal.tasks.properties.bean.AbstractNestedRuntimeBeanNode$DefaultPropertyValue.getValue(AbstractNestedRuntimeBeanNode.java:138)
    at org.gradle.api.internal.artifacts.configurations.DefaultConfiguration$ConfigurationFileCollection.getFiles(DefaultConfiguration.java:1025)
    ... 137 more
Caused by: java.lang.RuntimeException: Failed to transform '/home/utkarsh/.gradle/caches/modules-2/files-2.1/com.android.tools.build.jetifier/jetifier-core/1.0.0-alpha10/9eb7027c383061de12f93aae7a22cbeb97832d2a/jetifier-core-1.0.0-alpha10.jar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android/support/v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.) To disable Jetifier, set android.enableJetifier=false in your gradle.properties file.
    at com.android.build.gradle.internal.dependency.JetifyTransform.transform(JetifyTransform.kt:204)
    at org.gradle.api.internal.artifacts.transform.TransformArtifactsAction.apply(TransformArtifactsAction.java:44)
    at org.gradle.api.internal.artifacts.transform.TransformArtifactsAction.apply(TransformArtifactsAction.java:29)
    at org.gradle.api.internal.artifacts.transform.DefaultTransformedFileCache$TransformAction.execute(DefaultTransformedFileCache.java:251)
    at org.gradle.api.internal.artifacts.transform.DefaultTransformedFileCache$TransformAction.execute(DefaultTransformedFileCache.java:238)
    at com.android.tools.build.jetifier.processor.transform.bytecode.asm.CustomRemapper.mapValue(CustomRemapper.kt:75)
    at org.objectweb.asm.commons.MethodRemapper.visitLdcInsn(MethodRemapper.java:179)
    at org.objectweb.asm.ClassReader.readCode(ClassReader.java:1582)
    at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1126)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:698)
    at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
    at com.android.tools.build.jetifier.processor.transform.bytecode.ByteCodeTransformer.runTransform(ByteCodeTransformer.kt:39)
    at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:366)
    at com.android.tools.build.jetifier.processor.archive.ArchiveFile.accept(ArchiveFile.kt:41)
    at com.android.tools.build.jetifier.processor.Processor.visit(Processor.kt:348)
    at com.android.tools.build.jetifier.processor.archive.Archive.accept(Archive.kt:70)
    at com.android.tools.build.jetifier.processor.Processor.transformLibrary(Processor.kt:344)
    at com.android.tools.build.jetifier.processor.Processor.transform(Processor.kt:207)
    at com.android.build.gradle.internal.dependency.JetifyTransform.transform(JetifyTransform.kt:199)
    ... 189 more

build.gradle file:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    apply from: rootProject.file('dependencies.gradle')

    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}"
        classpath 'com.google.gms:google-services:4.2.0'
        classpath 'io.fabric.tools:gradle:1.27.0'

        classpath "com.github.ben-manes:gradle-versions-plugin:0.20.0"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://jitpack.io" }
    }

    apply from: rootProject.file('dependencies.gradle')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

dependencies.gradle file:

ext {
    versions = [
            // For project configuration
            java                  : JavaVersion.VERSION_1_8,
            compileSdk            : 28,
            targetSdk             : 28,
            minSdk                : 21,
            buildTools            : '28.0.3',
            dokka                 : '0.9.16',

            // For app
            kotlin                : '1.2.71',
            coroutine             : '0.25.0',

            appCompat             : '1.0.0',
            recyclerview          : '1.0.0',
            constraintLayout      : '2.0.0-alpha2',
            cardview              : '1.0.0',
            browser               : '1.0.0',
            androidKtx            : '1.0.0',
            legacy                : '1.0.0',
            workmanager           : '1.0.0-alpha09',

            dagger                : '2.20',
            firebaseCloudMessage  : '17.3.0',
            firebaseAnalytics     : '16.0.3',
            playServices          : '16.0.0',
            exoPlayer             : '2.8.2',
            flexbox               : '1.1.0',
            material              : '1.0.0-beta01',

            room                  : '2.0.0',
            lifecycle             : '2.0.0',

            livedataKtx           : '2.0.1',

            rxKotlin              : '2.3.0',
            rxAndroid             : '2.1.0',

            moshi                 : '1.6.0',
            okhttp                : '3.11.0',

            timber                : '4.7.1',
            threeTenABP           : '1.1.0',
            rxBinding             : '2.1.1',

            fresco                : '1.10.0',

            kotshi                : '1.0.4',

            frescoImageViewer     : '0.5.1',
            markwon               : '2.0.0',
            aVLoadingIndicatorView: '2.1.3',
            glide                 : '4.8.0',

            // For wearable
            wear                  : '2.3.0',
            playServicesWearable  : '15.0.1',
            supportWearable       : '27.1.1',

            // For testing
            junit                 : '4.12',
            truth                 : '0.42',
            espresso              : '3.1.0-alpha4',
            mockito               : '2.21.0'
    ]
    libraries = [
            kotlin                : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
            coroutines            : "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutine}",
            coroutinesAndroid     : "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutine}",

            appCompat             : "androidx.appcompat:appcompat:${versions.appCompat}",
            recyclerview          : "androidx.recyclerview:recyclerview:${versions.recyclerview}",
            constraintlayout      : "androidx.constraintlayout:constraintlayout:${versions.constraintLayout}",
            cardview              : "androidx.cardview:cardview:${versions.cardview}",
            browser               : "androidx.browser:browser:${versions.browser}",
            androidKtx            : "androidx.core:core-ktx:${versions.androidKtx}",
            fragmentsKtx          : "androidx.fragment:fragment-ktx:${versions.androidKtx}",
            legacy                : "androidx.legacy:legacy-support-v4:${versions.legacy}",
            workmanager           : "android.arch.work:work-runtime-ktx:${versions.workmanager}",
            workmanagerFirebase   : "android.arch.work:work-firebase:${versions.workmanager}",

            dagger                : "com.google.dagger:dagger:${versions.dagger}",
            daggerSupport         : "com.google.dagger:dagger-android-support:${versions.dagger}",
            daggerProcessor       : "com.google.dagger:dagger-compiler:${versions.dagger}",
            daggerAndroidApt      : "com.google.dagger:dagger-android-processor:${versions.dagger}",
            exoPlayer             : "com.google.android.exoplayer:exoplayer:${versions.exoPlayer}",
            flexbox               : "com.google.android:flexbox:${versions.flexbox}",
            material              : "com.google.android.material:material:${versions.material}",

            room                  : "androidx.room:room-runtime:${versions.room}",
            roomProcessor         : "androidx.room:room-compiler:${versions.room}",
            lifecycleExtensions   : "androidx.lifecycle:lifecycle-extensions:${versions.lifecycle}",
            lifecycleCompiler     : "androidx.lifecycle:lifecycle-compiler:${versions.lifecycle}",
            viewmodelKtx          : "androidx.lifecycle:lifecycle-viewmodel-ktx:${versions.lifecycle}",

            livedataKtx           : "com.shopify:livedata-ktx:${versions.livedataKtx}",

            rxKotlin              : "io.reactivex.rxjava2:rxkotlin:${versions.rxKotlin}",
            rxAndroid             : "io.reactivex.rxjava2:rxandroid:${versions.rxAndroid}",

            moshi                 : "com.squareup.moshi:moshi:${versions.moshi}",
            moshiKotlin           : "com.squareup.moshi:moshi-kotlin:${versions.moshi}",
            okhttp                : "com.squareup.okhttp3:okhttp:${versions.okhttp}",
            okhttpLogger          : "com.squareup.okhttp3:logging-interceptor:${versions.okhttp}",

            timber                : "com.jakewharton.timber:timber:${versions.timber}",
            threeTenABP           : "com.jakewharton.threetenabp:threetenabp:${versions.threeTenABP}",
            rxBinding             : "com.jakewharton.rxbinding2:rxbinding-kotlin:${versions.rxBinding}",

            fresco                : "com.facebook.fresco:fresco:${versions.fresco}",
            frescoOkHttp          : "com.facebook.fresco:imagepipeline-okhttp3:${versions.fresco}",
            frescoAnimatedGif     : "com.facebook.fresco:animated-gif:${versions.fresco}",
            frescoWebP            : "com.facebook.fresco:webpsupport:${versions.fresco}",
            frescoAnimatedWebP    : "com.facebook.fresco:animated-webp:${versions.fresco}",

            kotshiApi             : "se.ansman.kotshi:api:${versions.kotshi}",
            kotshiCompiler        : "se.ansman.kotshi:compiler:${versions.kotshi}",

            frescoImageViewer     : "com.github.luciofm:FrescoImageViewer:${versions.frescoImageViewer}",
            glide                 : "com.github.bumptech.glide:glide:${versions.glide}",
            glideProcessor        : "com.github.bumptech.glide:compiler:${versions.glide}",

            markwon               : "ru.noties:markwon:${versions.markwon}",

            aVLoadingIndicatorView: "com.wang.avi:library:${versions.aVLoadingIndicatorView}",

            // Proprietary libraries
            fcm                   : "com.google.firebase:firebase-messaging:${versions.firebaseCloudMessage}",
            firebaseAnalytics     : "com.google.firebase:firebase-core:${versions.firebaseAnalytics}",
            playServicesAuth      : "com.google.android.gms:play-services-auth:${versions.playServices}",

            // For wearable
            wearable              : "com.google.android.support:wearable:${versions.wear}",
            playServicesWearable  : "com.google.android.gms:play-services-wearable:${versions.playServicesWearable}",
            percentLayout         : "com.android.support:percent:${versions.supportWearable}",
            supportWearable       : "com.android.support:support-v4:${versions.supportWearable}",
            wearableRecyclerView  : "com.android.support:recyclerview-v7:${versions.supportWearable}",
            wearSupport           : "com.android.support:wear:${versions.supportWearable}",

            // For testing
            junit                 : "junit:junit:${versions.junit}",
            espressoCore          : "androidx.test.espresso:espresso-core:${versions.espresso}",
            espressoIntents       : "androidx.test.espresso:espresso-intents:${versions.espresso}",
            roomTest              : "android.arch.persistence.room:testing:${versions.room}",
            truth                 : "com.google.truth:truth:${versions.truth}"
    ]
}
like image 659
Utkarsh Barsaiyan Avatar asked Jan 15 '19 21:01

Utkarsh Barsaiyan


3 Answers

Hi I had similar issue.

error message -

The given artifact contains a string literal with a package reference 'android.support.design.widget' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.

I figured out safe args dependency was causing this error.

implementation "android.arch.navigation:navigation-safe-args-gradle-plugin:$version_navigation"

If I remove this dependency project build successfully. You can try downgrading dependency version I am using '1.0.0'

like image 62
Shivam Sompura Avatar answered Nov 13 '22 12:11

Shivam Sompura


This can also be caused by safeargs being added as a library dependency, instead of as a Gradle plugin.

Wrong:

implementation "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"in your module level build.gradle's dependencies.

Right:

classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" in your project level build.gradle's dependencies (as well as apply plugin: "androidx.navigation.safeargs").

Source: https://developer.android.com/guide/navigation/navigation-pass-data#Safe-args

like image 29
Jake Lee Avatar answered Nov 13 '22 14:11

Jake Lee


this has nothing to do with the data-binding library, but with the Jetifier for androidx migration:

The given artifact contains a string literal with a package reference 'android/support/v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.

... is what com.android.tools.build.jetifier.processor complains about.

the corresponding class would be: androidx.legacy:legacy-support-v4:1.0.0.

like image 3
Martin Zeitler Avatar answered Nov 13 '22 14:11

Martin Zeitler