Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to fix NoClassDefFoundError #10

Open
HenryUdorji opened this issue May 10, 2024 · 3 comments
Open

How to fix NoClassDefFoundError #10

HenryUdorji opened this issue May 10, 2024 · 3 comments

Comments

@HenryUdorji
Copy link

HenryUdorji commented May 10, 2024

Build Environment

Operating System: Windows 10
Gradle Plugin Version: 8.3.0
Gradle Version: 8.6
aaraar Version: 0.0.14

Description

The plugin is able to build the aar libraries into the final aar but at runtime when using the library I think it is not able to access the R files.

Error Log

2024-05-11 14:20:19.578 7314-7314 AndroidRuntime com.ifechukwu.contactlesspay E FATAL EXCEPTION: main (Ask Gemini) Process: com.ifechukwu.contactlesspay, PID: 7314 android.view.InflateException: Binary XML file line #122 in com.ifechukwu.contactlesspay:layout/plugin_fragment_enter_card_pin: Binary XML file line #122 in com.ifechukwu.contactlesspay:layout/plugin_fragment_enter_card_pin: Error inflating class com.mastercard.sonic.widget.SonicView Caused by: android.view.InflateException: Binary XML file line #122 in com.ifechukwu.contactlesspay:layout/plugin_fragment_enter_card_pin: Error inflating class com.mastercard.sonic.widget.SonicView Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:858) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1014) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965) at android.view.LayoutInflater.rInflate(LayoutInflater.java:1144) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105) at android.view.LayoutInflater.inflate(LayoutInflater.java:686) at android.view.LayoutInflater.inflate(LayoutInflater.java:538) at com.globalaccelerex.gasoftpossdk.databinding.PluginFragmentEnterCardPinBinding.inflate(PluginFragmentEnterCardPinBinding.java:101) at com.globalaccelerex.gasoftpossdk.databinding.PluginFragmentEnterCardPinBinding.inflate(PluginFragmentEnterCardPinBinding.java:95) at com.globalaccelerex.gasoftpossdk.internal.ui.fragment.enterPin.EnterCardPinFragment.onCreateView(EnterCardPinFragment.kt:72) at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114) at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557) at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272) at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943) at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845) at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782) at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:204) at android.os.Looper.loop(Looper.java:291) at android.app.ActivityThread.main(ActivityThread.java:8133) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019) Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mastercard/sonic/R$styleable; at com.mastercard.sonic.widget.SonicView.<init>(SonicView.kt:65) at com.mastercard.sonic.widget.SonicView.<init>(SonicView.kt:41) at com.mastercard.sonic.widget.SonicView.<init>(Unknown Source:11) at java.lang.reflect.Constructor.newInstance0(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:343)  at android.view.LayoutInflater.createView(LayoutInflater.java:858)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1014)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:1144)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105)  at android.view.LayoutInflater.inflate(LayoutInflater.java:686)  at android.view.LayoutInflater.inflate(LayoutInflater.java:538)  at com.globalaccelerex.gasoftpossdk.databinding.PluginFragmentEnterCardPinBinding.inflate(PluginFragmentEnterCardPinBinding.java:101)  at com.globalaccelerex.gasoftpossdk.databinding.PluginFragmentEnterCardPinBinding.inflate(PluginFragmentEnterCardPinBinding.java:95)  at com.globalaccelerex.gasoftpossdk.internal.ui.fragment.enterPin.EnterCardPinFragment.onCreateView(EnterCardPinFragment.kt:72)  at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)  at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)  at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)  at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)  at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)  at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)  at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)  at android.os.Handler.handleCallback(Handler.java:942)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loopOnce(Looper.java:204)  at android.os.Looper.loop(Looper.java:291)  at android.app.ActivityThread.main(ActivityThread.java:8133)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)  Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mastercard.sonic.R$styleable" on path: DexPathList[[dex file "/data/data/com.ifechukwu.contactlesspay/code_cache/.overlay/base.apk/classes2.dex", zip file "/data/app/~~F0McEfwE6RmyQUDg-u_lpg==/com.ifechukwu.contactlesspay-IlvY4fPq5NCC_Us5ilnDIw==/base.apk"],nativeLibraryDirectories=[/data/app/~~F0McEfwE6RmyQUDg-u_lpg==/com.ifechukwu.contactlesspay-IlvY4fPq5NCC_Us5ilnDIw==/lib/arm64, /data/app/~~F0McEfwE6RmyQUDg-u_lpg==/com.ifechukwu.contactlesspay-IlvY4fPq5NCC_Us5ilnDIw==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:259) at java.lang.ClassLoader.loadClass(ClassLoader.java:379) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at com.mastercard.sonic.widget.SonicView.<init>(SonicView.kt:65)  at com.mastercard.sonic.widget.SonicView.<init>(SonicView.kt:41)  at com.mastercard.sonic.widget.SonicView.<init>(Unknown Source:11)  at java.lang.reflect.Constructor.newInstance0(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:343)  at android.view.LayoutInflater.createView(LayoutInflater.java:858)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1014)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:1144)  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1105)  at android.view.LayoutInflater.inflate(LayoutInflater.java:686)  at android.view.LayoutInflater.inflate(LayoutInflater.java:538)  at com.globalaccelerex.gasoftpossdk.databinding.PluginFragmentEnterCardPinBinding.inflate(PluginFragmentEnterCardPinBinding.java:101)  at com.globalaccelerex.gasoftpossdk.databinding.PluginFragmentEnterCardPinBinding.inflate(PluginFragmentEnterCardPinBinding.java:95)  at com.globalaccelerex.gasoftpossdk.internal.ui.fragment.enterPin.EnterCardPinFragment.onCreateView(EnterCardPinFragment.kt:72)  at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)  at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)  at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)  at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)  at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)  at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)  at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)  at android.os.Handler.handleCallback(Handler.java:942)  at android.os.Handler.dispatchMessage(Handler.java:99)  at android.os.Looper.loopOnce(Looper.java:204)  at android.os.Looper.loop(Looper.java:291)  at android.app.ActivityThread.main(ActivityThread.java:8133)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:588)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1019)  

Dependencies

` dependencies {

  • api project(':mastercardSonic')
    
  • api project(':visaSensoryBranding')
    
  • compileOnly project(":mastercardSonic")
    
  • embed project(":mastercardSonic")
    
  • compileOnly project(":visaSensoryBranding")
    
  • embed project(":visaSensoryBranding")
    

}
`

@christiandeange
Copy link
Owner

Hi there! Sorry for the delay in responding. Are you able to decompile/inspect your compiled apk file and see if the com.mastercard.sonic.R.styleable class (probably compiled into a com/mastercard/sonic/R$styleable.class file) is present anywhere?

@HenryUdorji
Copy link
Author

Hello @christiandeange, thanks for responding. So I inspected the classes2.dex file and I could not find the R$Styleable.class file in the applications package but when I check the package of the library it is available there

classes2.dex (Application Package)
image
image

classes2.dex(Library Package)
image

@christiandeange
Copy link
Owner

Version 0.0.18 contains a fix for an issue relating to embedding resources. Would you be able to try this version out and verify if your issue is now resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants