Android Question AppCompat error

Indy

Active Member
Licensed User
Longtime User
Hi All

I'm trying to set the new version of AppCompat library but am having quite a few issues. I tested the example project which works absolutely fine, so I know the setup must be ok. I'm thinking it might something to do with my code but, cannot pin point it. I've posted the error I'm getting in the hope that someone may recognise it and know a possible fix.

B4X:
** Activity (intro) Pause, UserClosed = true **
** Activity (menu) Create, isFirst = true **
menu_activity_create (java line: 352)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
   at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
   at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
   at nhdc.wasteforms.com.menu._activity_create(menu.java:352)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
   at nhdc.wasteforms.com.menu.afterFirstLayout(menu.java:102)
   at nhdc.wasteforms.com.menu.access$000(menu.java:17)
   at nhdc.wasteforms.com.menu$WaitForLayout.run(menu.java:80)
   at android.os.Handler.handleCallback(Handler.java:739)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:135)
   at android.app.ActivityThread.main(ActivityThread.java:5595)
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.reflect.InvocationTargetException
   at java.lang.reflect.Method.invoke(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:372)
   at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
   at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
   ... 16 more
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/design/R$attr;
   at android.support.design.widget.ThemeUtils.<clinit>(ThemeUtils.java:25)
   at android.support.design.widget.TabLayout.<init>(TabLayout.java:232)
   at android.support.design.widget.TabLayout.<init>(TabLayout.java:226)
   at android.support.design.widget.TabLayout.<init>(TabLayout.java:222)
   at de.amberhome.objects.TabLayoutWrapper.innerInitialize(TabLayoutWrapper.java:78)
   at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:65)
   at de.amberhome.objects.TabLayoutWrapper.Initialize(TabLayoutWrapper.java:44)
   at de.amberhome.objects.TabLayoutWrapper._initialize(TabLayoutWrapper.java:86)
   ... 20 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.R$attr" on path: DexPathList[[zip file "/data/app/nhdc.wasteforms.com-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
   at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
   ... 28 more
   Suppressed: java.lang.ClassNotFoundException: android.support.design.R$attr
     at java.lang.Class.classForName(Native Method)
     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
     ... 29 more
   Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

Thanks
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Indy

Active Member
Licensed User
Longtime User
We cannot point it too if you dont show your code!

Hi,

Sorry was busy for a few days so didn't get around to posting code. Here the Create function which seems to not work.

B4X:
Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   Activity.LoadLayout("Layout1")
   
   ToolBar.SetAsActionBar
   ToolBar.Title = "NHDC Waste Management"
   ToolBar.SubTitle = "Forms"
   'ToolBar.LogoBitmap=LoadBitmap(File.DirAssets,"icon.png")
   ToolBar.Color = Main.tabcol
   'Initialize a PageContainer Object
   PC.Initialize
   VP.Top = ToolBar.Height

   ScrollView1.Initialize(DipToCurrent(VP.Height))
   Activity.AddView(ScrollView1, 0, VP.Top, 100%x, 100%y)
   ScrollView1.Panel.LoadLayout("Menu")
   sv_ht = (Button4.Top + Button4.Height) + Panel1.Top + VP.Top
   If sv_ht < Activity.Height + ToolBar.Height Then
     sv_ht = Activity.Height + ToolBar.Height
   End If
   ScrollView1.Panel.Height = (sv_ht)
   Activity.AddMenuItem3("Exit","Exit", LoadBitmap(File.DirAssets,"ic_exit_to_app_white_36dp.png"), True)
   strWIPText = ""
   If File.Exists(Main.SavePath, "DriversCheckList.csv") Then
     strWIPText = CRLF & "(continue...)"
   End If
   Button1.Text = Button1.Text & strWIPText
End Sub

Thanks
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
It looks as if you are using DSTabLayout.
It is the source of many problems for those who have upgraded to Android -28
 
Upvote 0
Top