Reputation: 6604
I am doing Unity Ads integration in native android. But I am facing below issue.
java.lang.NoClassDefFoundError: com.unity3d.ads.android.R$layout
at com.unity3d.ads.android.video.UnityAdsVideoPlayView.e(UnityAdsVideoPlayView.java:225)
at com.unity3d.ads.android.video.UnityAdsVideoPlayView.<init>(UnityAdsVideoPlayView.java:62)
at com.unity3d.ads.android.view.UnityAdsMainView.setViewState(UnityAdsMainView.java:76)
at com.unity3d.ads.android.view.b.run(UnityAdsFullscreenActivity.java:593)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5099)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:803)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:570)
at dalvik.system.NativeStart.main(Native Method)
Can anybody help me how to resolve that. I have this resource file in layout then too I face this error.
Upvotes: 1
Views: 3344
Reputation: 131
I had the exact same problem as you, and the solution was to download the aar file oalpayli told you about, put it inside the libs folder, and in gradle add this code:
dependencies {
compile(name:'unity-ads',ext:'aar')
}
repositories {
flatDir {
dirs 'libs'
}
}
Upvotes: 6
Reputation: 265
This issue has been addressed in the latest SDK update. Please follow these instructions to update:
This should fix the R$Layout issue.
Upvotes: 2