# ClassCastException while building apm android agent 1.0.0

**URL:** <https://discuss.elastic.co/t/classcastexception-while-building-apm-android-agent-1-0-0/378729>\
**Category:** Elastic Agent\
**Created:** [May 30, 2025, 9:27am UTC](https://discuss.elastic.co/t/classcastexception-while-building-apm-android-agent-1-0-0/378729 "2025-05-30T09:27:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rakesh\_Patel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rakesh_patel/32/142553_2.png) [@Rakesh\_Patel](https://discuss.elastic.co/u/Rakesh_Patel)\
**Post date:** [May 30, 2025, 9:27am UTC](https://discuss.elastic.co/t/classcastexception-while-building-apm-android-agent-1-0-0/378729/1 "2025-05-30T09:27:13Z")

</div>

I'm getting this exception while building elastic android agent 1.0.0 , i  
just simply clone the project and running ./gradlew publishToMavenLocal

FAILURE: Build failed with an exception.

- What went wrong:  
A problem occurred configuring project ':agent-sdk'.

> java.lang.ClassCastException: class  
> com.android.build.api.component.analytics.AnalyticsEnabledLibraryVariant\_Decorated  
> cannot be cast to class com.android.build.api.component.impl.ComponentImpl  
> (com.android.build.api.component.analytics.AnalyticsEnabledLibraryVariant\_Decorated  
> and com.android.build.api.component.impl.ComponentImpl are in unnamed  
> module of loader  
> org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader  
> @79ad01dc)
