Spanish [SOLUCIONADO]Error en ejemplo Toolbar

josete

Member
Licensed User
Longtime User
Al probar este ejemplo del foro https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/ me sale el siguiente error:
B4X:
Registo conectado a:  Xiaomi Mi A2 Lite
--------- beginning of main
** Activity (main) Create, isFirst = true **
Error occurred on line: 45 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at de.amberhome.appcompat.toolbarexample1.main._activity_create(main.java:418)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:104)
    at de.amberhome.appcompat.toolbarexample1.main.access$000(main.java:17)
    at de.amberhome.appcompat.toolbarexample1.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6694)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/Toolbar;
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4a.shell.Shell.getCorrectClassName(Shell.java:624)
    at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:611)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:366)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.initializeGlobals(main.java:320)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:101)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Toolbar" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/de.amberhome.appcompat.toolbarexample1-0eLdSOn_Doc2fBi6KQtMBg==/base.apk"],nativeLibraryDirectories=[/data/app/de.amberhome.appcompat.toolbarexample1-0eLdSOn_Doc2fBi6KQtMBg==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 20 more
** Activity (main) Resume **
** Activity (main) Create, isFirst = true **
Error occurred on line: 45 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at de.amberhome.appcompat.toolbarexample1.main._activity_create(main.java:418)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:104)
    at de.amberhome.appcompat.toolbarexample1.main.access$000(main.java:17)
    at de.amberhome.appcompat.toolbarexample1.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6694)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/Toolbar;
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4a.shell.Shell.getCorrectClassName(Shell.java:624)
    at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:611)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:366)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.initializeGlobals(main.java:320)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:101)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Toolbar" on path: DexPathList[[zip file "/data/app/de.amberhome.appcompat.toolbarexample1-1Ch7sBkqGPQ9IMSOJDdvdA==/base.apk"],nativeLibraryDirectories=[/data/app/de.amberhome.appcompat.toolbarexample1-1Ch7sBkqGPQ9IMSOJDdvdA==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 20 more
** Activity (main) Resume **
** Activity (main) Create, isFirst = true **
Error occurred on line: 45 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at de.amberhome.appcompat.toolbarexample1.main._activity_create(main.java:418)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:104)
    at de.amberhome.appcompat.toolbarexample1.main.access$000(main.java:17)
    at de.amberhome.appcompat.toolbarexample1.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6694)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/Toolbar;
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4a.shell.Shell.getCorrectClassName(Shell.java:624)
    at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:611)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:366)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.initializeGlobals(main.java:320)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:101)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Toolbar" on path: DexPathList[[zip file "/data/app/de.amberhome.appcompat.toolbarexample1-1Ch7sBkqGPQ9IMSOJDdvdA==/base.apk"],nativeLibraryDirectories=[/data/app/de.amberhome.appcompat.toolbarexample1-1Ch7sBkqGPQ9IMSOJDdvdA==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 20 more
** Activity (main) Resume **
** Activity (main) Create, isFirst = true **
Error occurred on line: 45 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at de.amberhome.appcompat.toolbarexample1.main._activity_create(main.java:418)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:104)
    at de.amberhome.appcompat.toolbarexample1.main.access$000(main.java:17)
    at de.amberhome.appcompat.toolbarexample1.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6694)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/Toolbar;
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4a.shell.Shell.getCorrectClassName(Shell.java:624)
    at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:611)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:366)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.initializeGlobals(main.java:320)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:101)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Toolbar" on path: DexPathList[[zip file "/data/app/de.amberhome.appcompat.toolbarexample1-yI2RQOJXp8NekiKXuGunUQ==/base.apk"],nativeLibraryDirectories=[/data/app/de.amberhome.appcompat.toolbarexample1-yI2RQOJXp8NekiKXuGunUQ==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 20 more
** Activity (main) Resume **
** Activity (main) Create, isFirst = true **
Error occurred on line: 45 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
    at de.amberhome.appcompat.toolbarexample1.main._activity_create(main.java:418)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:104)
    at de.amberhome.appcompat.toolbarexample1.main.access$000(main.java:17)
    at de.amberhome.appcompat.toolbarexample1.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6694)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:162)
    ... 18 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/widget/Toolbar;
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4a.shell.Shell.getCorrectClassName(Shell.java:624)
    at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:611)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:366)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at de.amberhome.appcompat.toolbarexample1.main.initializeGlobals(main.java:320)
    at de.amberhome.appcompat.toolbarexample1.main.afterFirstLayout(main.java:101)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Toolbar" on path: DexPathList[[zip file "/data/app/de.amberhome.appcompat.toolbarexample1-yI2RQOJXp8NekiKXuGunUQ==/base.apk"],nativeLibraryDirectories=[/data/app/de.amberhome.appcompat.toolbarexample1-yI2RQOJXp8NekiKXuGunUQ==/lib/arm64, /system/lib64, /vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 20 more
** Activity (main) Resume **
En principio tengo los archivos Appcompat.aar,Appcompat.jar,Appcompat.xml en la carpeta de Librerias Adicionales y la ruta a esa carpeta configurada.La aplicacion compila bien y crashea al iniciar.
 

josejad

Expert
Licensed User
Longtime User
Prueba a ir al menú Herramientas->Jetifier y pulsa el botón "Jetify"
 

josete

Member
Licensed User
Longtime User
Sigue el mismo error.Edito por que he cerrado el IDE y al volver a reiniciar funciona.¿Que es eso de jetify?
 
Last edited:

josejad

Expert
Licensed User
Longtime User
Un nuevo paso que hay que hacer solo con algunas librerias que hagan llamadas a la biblioteca de compatibilidad, desde que entro el androidx sdk.

 
Top