Android Question [SOLVED] AppCompat don't work

Discussion in 'Android Questions' started by Ago80, Aug 18, 2019.

  1. Ago80

    Ago80 Member Licensed User

    Hi everyone,
    i have download the Erel's AppCompat with ToolBar- minimal example
    https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/
    but i got this error:

    *** Service (starter) Create ***
    ** Service (starter) Start **
    Error occurred on line: 25 (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 b4a.example.main._activity_create(main.java:385)
    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 b4a.example.main.afterFirstLayout(main.java:104)
    at b4a.example.main.access$000(main.java:17)
    at b4a.example.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:6669)
    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 b4a.example.main.initializeGlobals(main.java:320)
    at b4a.example.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/b4a.example-Izfd_jf9bbT7-QrgOtCZ_g==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-Izfd_jf9bbT7-QrgOtCZ_g==/lib/x86_64, /system/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 **

    This is the line #25

    Code:
    Activity.LoadLayout("1")
    My B4A version is 9.30

    Anyone can help?

    Regards
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    1. Make sure to copy the library to the additional libraries folder.
    2. Run Tools - Jetify.
    3. Clean the project (Ctrl + P)
     
  3. Ago80

    Ago80 Member Licensed User

    Thank you Erel for your reply.
    Now your example works
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice