I'm trying to update the Design support library to use maven repositories and get a strange problem/error.
The DesignSupport library depends on AppCompat libraries and a AppCompat Theme.
If I remove all @DependsOn Annotations from the libraries (AppCompat and DesignSupport) and only add
in the B4A Code, all works fine.
The google design support library has dependencies itself for appcompat, so the correct libraries like appcompat and support v4 are automatically added to the project.
Now the problem:
If I add the
to the AppCompat Library OR I just add
BEFORE the #AdditionalJar entry for the design support Library I get this error:
So the design support library does not detect that it runs with an AppCompat Theme. I have no idea, why this happens but I think it has something to do with the order the libraries are added.
@Erel: Any idea how to fix this?
The DesignSupport library depends on AppCompat libraries and a AppCompat Theme.
If I remove all @DependsOn Annotations from the libraries (AppCompat and DesignSupport) and only add
B4X:
#AdditionalJar: com.android.support:design
The google design support library has dependencies itself for appcompat, so the correct libraries like appcompat and support v4 are automatically added to the project.
Now the problem:
If I add the
B4X:
@DependsOn(values = { "com.android.support:appcompat-v7" })
B4X:
#AdditionalJar: com.android.support:appcompat-v7
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = true **
** Activity (main) Create, isFirst = false **
main_activity_create (java line: 337)
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 example.tablayout.scrollingtabs.main._activity_create(main.java:337)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at example.tablayout.scrollingtabs.main.afterFirstLayout(main.java:102)
at example.tablayout.scrollingtabs.main.access$000(main.java:17)
at example.tablayout.scrollingtabs.main$WaitForLayout.run(main.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:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
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:158)
... 14 more
Caused by: java.lang.IllegalArgumentException: You need to use a Theme.AppCompat theme (or descendant) with the design library.
at android.support.design.widget.ThemeUtils.checkAppCompatTheme(ThemeUtils.java:36)
at android.support.design.widget.TabLayout.<init>(TabLayout.java:291)
at android.support.design.widget.TabLayout.<init>(TabLayout.java:285)
at android.support.design.widget.TabLayout.<init>(TabLayout.java:281)
at de.amberhome.objects.TabLayoutWrapper.innerInitialize(TabLayoutWrapper.java:87)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:65)
at de.amberhome.objects.TabLayoutWrapper.Initialize(TabLayoutWrapper.java:53)
at de.amberhome.objects.TabLayoutWrapper._initialize(TabLayoutWrapper.java:95)
... 17 more
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
So the design support library does not detect that it runs with an AppCompat Theme. I have no idea, why this happens but I think it has something to do with the order the libraries are added.
@Erel: Any idea how to fix this?