Appodeal Not Found Exception
Unity: All Versions | Appodeal SDK: All Versions
The following exception on Appodeal SDK initializing occurs if the Appodeal dependency has not been imported into the mainTemplate.gradle file, resulting in no ads on the device.
AndroidJavaException: java.lang.ClassNotFoundException: com.appodeal.ads.Appodeal
08-05 17:56:52.361 17621 19642 E Unity : java.lang.ClassNotFoundException: com.appodeal.ads.Appodeal
08-05 17:56:52.361 17621 19642 E Unity : at java.lang.Class.classForName(Native Method)
08-05 17:56:52.361 17621 19642 E Unity : at java.lang.Class.forName(Class.java:454)
08-05 17:56:52.361 17621 19642 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
08-05 17:56:52.361 17621 19642 E Unity : at com.unity3d.player.UnityPlayer.access$300(Unknown Source:0)
08-05 17:56:52.361 17621 19642 E Unity : at com.unity3d.player.UnityPlayer$e$1.handleMessage(Unknown Source:95)
08-05 17:56:52.361 17621 19642 E Unity : at android.os.Handler.dispatchMessage(Handler.java:102)
08-05 17:56:52.361 17621 19642 E Unity : at android.os.Looper.loop(Looper.java:246)
08-05 17:56:52.361 17621 19642 E Unity : at com.unity3d.player.UnityPlayer$e.run(Unknown Source:20)
08-05 17:56:52.361 17621 19642 E Unity : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.appodeal.ads.Appodeal" on path: DexPathList[[zip file "/data/app/~~LZ2ZUoy1wx6uO6K32tjtVg==/com.appodeal.test-c2MK2vNy6WEMOqDgbY_VSQ==/base.apk"],nativeLibraryDirectories=[/data/app/~~LZ2ZUoy1wx6uO6K32tjtVg==/com.appodeal.test-c2MK2vNy6WEMOqDgbY_VSQ==/lib/arm, /data/app/~~LZ2ZUoy1wx6uO6K32tjtVg==/com.appodeal.test-c2MK2vNy6WEM
To fix it complete the following steps from Android configuration section to resolve Appodeal's dependencies:
-
After the import Appodeal Unity Plugin, in the Unity editor select File → Build Settings → Android.
-
Add flag Custom Gradle Template for Unity 2017.4 - Unity 2019.2 versions or Custom Main Gradle Template for Unity 2019.3 or higher (Build Settings → Player Settings → Publishing settings).
-
Enable the setting "Patch mainTemplate.gradle" (Assets → External Dependency Manager → Android Resolver → Settings).
-
Enable the setting "Use Jetifier" (Assets → External Dependency Manager → Android Resolver → Settings).
-
Then run Assets → External Dependency Manager → Android Resolver and press Resolve or Force Resolve.
-
As a result, the modules, that are required for the Appodeal SDK support, will be imported to project's mainTemplate.gradle file.