Need help for recyclerview library

When i used recyclerview in appinventor .recyclerview working on compain but not working in apk its crashed how to use recyclerview without errors
If i drag listview viewcomponent its work on both apk and compain but this not good solution how to resolve this errors

Provide link to the recyclerview library you are using, and show how your are implementing it in your aia project.

If you are working on an extension, you may try including the recyclerview.jar file with the extension and use ProGuard to repackage its classes. This should work fine until you use the ItemTouchHelper class.

I used recyclerview.jar file and build extension giving apk build error d8 error if i remove jar and build apk its successful build apk but without listview component not working

What version of recyclerview.jar are you using?

This is due to conflicts with built-in libraries. You must repackage the classes with proguard.

Recyclerview-1.3.2

You may try with 1.1.0.

ok illl try thanks

i used this version giving this error

  • Warning: androidx.recyclerview.selection.SelectionTracker$Builder: can't find referenced class androidx.recyclerview.selection.R$drawable

  • Warning: androidx.recyclerview.selection.SelectionTracker$Builder: can't find referenced class androidx.recyclerview.selection.R$drawable

  • Warning: androidx.recyclerview.selection.SelectionTracker$Builder: can't find referenced class androidx.recyclerview.selection.R

  • Note: com.varsha.materialcard.Util accesses a declared field 'mMenu' dynamically

  • Warning: there were 3 unresolved references to classes or interfaces.
    You may need to add missing library jars or update their versions.
    If your code works fine without the missing classes, you can suppress
    the warnings with '-dontwarn' options.
    (ProGuard Manual: Troubleshooting | Guardsquare)

  • Unexpected error

  • java.io.IOException: Please correct the above warnings first.
    at proguard.Initializer.execute(Initializer.java:526) ~[p8.jar:7.6.0]
    at proguard.pass.PassRunner.run(PassRunner.java:24) ~[p8.jar:7.6.0]
    at proguard.ProGuard.initialize(ProGuard.java:353) ~[p8.jar:7.6.0]
    at proguard.ProGuard.execute(ProGuard.java:142) ~[p8.jar:7.6.0]
    at proguard.ProGuard.main(ProGuard.java:648) [p8.jar:7.6.0]
    x BUILD FAILED!

Try adding this rule on the proguard-rules.pro

-dontwarn androidx.recyclerview.selection.R**
-dontnote com.varsha.materialcard.Util

If you’re using FAST to build your extension so you could directly use the aar file.

I m using fast so no need to add rules

1 Like

Try these rules first. And if you're using any newer APIs of 1.3.2 you have to change them to be compatible with 1.1.0.

build succsefully ill try

1 Like

without listview component not working after build apk its crash

Check the device logs and try to fix the issue.

I was working on a recyclerview project and that was working good without the in-built ListView component.

1 Like

Process: com.ai2offline.test.sample, PID: 6629
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/recyclerview/widget/RecyclerView;
at java.lang.reflect.Executable.getMethodReturnTypeInternal(Native Method)
at java.lang.reflect.Method.getReturnType(Method.java:148)
at java.lang.Class.getDeclaredMethods(Class.java:2728)
at gnu.bytecode.ClassType.addMethods(ClassType.java:979)
at gnu.bytecode.ClassType.getDeclaredMethods(ClassType.java:725)
at gnu.bytecode.ClassType.getMethods(ClassType.java:809)
at gnu.kawa.reflect.ClassMethods.getMethods(ClassMethods.java:106)
at gnu.kawa.reflect.ClassMethods.apply(ClassMethods.java:229)
at gnu.kawa.reflect.Invoke.lookupMethods(Invoke.java:278)
at gnu.kawa.reflect.Invoke.applyN(Invoke.java:185)
at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
at com.ai2offline.test.sample.Screen1.$define(Screen1.yail:10257)
at com.google.appinventor.components.runtime.Form.onCreateFinish(Form.java:407)
at com.google.appinventor.components.runtime.Form.onCreate(Form.java:352)
at com.ai2offline.test.sample.Screen1.onCreate(Screen1.yail:10003)
at android.app.Activity.performCreate(Activity.java:8975)
at android.app.Activity.performCreate(Activity.java:8944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4146)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
Caused by: java.lang.ClassNotFoundException: androidx.recyclerview.widget.RecyclerView
at java.lang.reflect.Executable.getMethodReturnTypeInternal(Native Method)
at java.lang.reflect.Method.getReturnType(Method.java:148)
at java.lang.Class.getDeclaredMethods(Class.java:2728)
at gnu.bytecode.ClassType.addMethods(ClassType.java:979)
at gnu.bytecode.ClassType.getDeclaredMethods(ClassType.java:725)
at gnu.bytecode.ClassType.getMethods(ClassType.java:809)
at gnu.kawa.reflect.ClassMethods.getMethods(ClassMethods.java:106)
at gnu.kawa.reflect.ClassMethods.apply(ClassMethods.java:229)
at gnu.kawa.reflect.Invoke.lookupMethods(Invoke.java:278)
at gnu.kawa.reflect.Invoke.applyN(Invoke.java:185)
at gnu.mapping.ProcedureN.apply2(ProcedureN.java:39)
at com.ai2offline.test.sample.Screen1.$define(Screen1.yail:10257)
at com.google.appinventor.components.runtime.Form.onCreateFinish(Form.java:407)
at com.google.appinventor.components.runtime.Form.onCreate(Form.java:352)
at com.ai2offline.test.sample.Screen1.onCreate(Screen1.yail:10003)
at android.app.Activity.performCreate(Activity.java:8975)
at android.app.Activity.performCreate(Activity.java:8944)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4146)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4322)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:230)
at android.os.Looper.loop(Looper.java:319)
at android.app.ActivityThread.main(ActivityThread.java:8919)

java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/recyclerview/widget/RecyclerView;

Are you keeping androidx.recyclerview.widget.RecyclerView class?

Sorry i dint understand in progurd or i have to import this class

You may learn how to write config for ProGuard from here.