Java Question [SOLVED] Cannot find the class from the package error

Pendrush

Well-Known Member
Licensed User
Longtime User
I am trying to update UnityAds wrapper, however, B4A reports that it cannot find the class from the package gatewayprotocol.v1, even though it is already present in classes.jar and of course in unity-ads.aar.

Is there a solution?

Library aar is HERE.

banner_activity_create (java line: 356)
java.lang.NoClassDefFoundError: Failed resolution of: Lgatewayprotocol/v1/NativeConfigurationOuterClass$NativeConfiguration;
at com.unity3d.services.core.di.ServiceProvider$initialize$1.invoke(ServiceProvider.kt:1092)
at com.unity3d.services.core.di.ServiceProvider$initialize$1.invoke(ServiceProvider.kt:285)
at com.unity3d.services.core.di.ServicesRegistryKt.registry(ServicesRegistry.kt:106)
at com.unity3d.services.core.di.ServiceProvider.initialize(ServiceProvider.kt:285)
at com.unity3d.services.core.di.ServiceProvider.<clinit>(ServiceProvider.kt:281)
at com.unity3d.services.core.misc.Utilities.getService(Utilities.java:212)
at com.unity3d.services.core.misc.Utilities.getService(Utilities.java:216)
at com.unity3d.services.core.device.Device.<clinit>(Device.java:60)
at com.unity3d.services.UnityServices.initialize(UnityServices.kt:109)
at com.unity3d.services.ads.UnityAdsImplementation.initialize(UnityAdsImplementation.java:66)
at com.unity3d.ads.UnityAds.initialize(UnityAds.kt:60)
at com.pendrush.unityads.wrapper.UnityAdsWrap.InitializeBanner2(UnityAdsWrap.java:59)
at com.pendrush.unityads.wrapper.UnityAdsWrap.InitializeBanner(UnityAdsWrap.java:54)
at b4a.example.banner._activity_create(banner.java:356)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at b4a.example.banner.afterFirstLayout(banner.java:105)
at b4a.example.banner.access$000(banner.java:17)
at b4a.example.banner$WaitForLayout.run(banner.java:83)
at android.os.Handler.handleCallback(Handler.java:959)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8705)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:580)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:886)
Caused by: java.lang.ClassNotFoundException: gatewayprotocol.v1.NativeConfigurationOuterClass$NativeConfiguration
... 27 more
1736247823020.png 1736247910016.png
 

DonManfred

Expert
Licensed User
Longtime User

So you need to add references to - at leeast - this

<dependencies>
<dependency>
<groupId>androidx.activity</groupId>
<artifactId>activity-ktx</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>androidx.core</groupId>
<artifactId>core-ktx</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>androidx.lifecycle</groupId>
<artifactId>lifecycle-process</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>androidx.lifecycle</groupId>
<artifactId>lifecycle-runtime-ktx</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>androidx.startup</groupId>
<artifactId>startup-runtime</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>androidx.webkit</groupId>
<artifactId>webkit</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>androidx.datastore</groupId>
<artifactId>datastore</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-coroutines-android</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>1.8.10</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.13</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-kotlin-lite</artifactId>
<version>3.21.12</version>
</dependency>
<dependency>
<groupId>androidx.work</groupId>
<artifactId>work-runtime-ktx</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-cronet</artifactId>
<version>18.0.1</version>
</dependency>
</dependencies>
</project>
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

Pendrush

Well-Known Member
Licensed User
Longtime User
That is a missing part. protobuf-kotlin-lite is just a wrapper around protobuf-java-lite.
 
Top