B4A Library AppCompat - Make Material Design apps compatible with older Android versions

Joy Garcia

Member
Licensed User
I've tried to load this sample project "AppCompatBase.b4a"

but when i load the Layout1 in Designer this popup message keep on the screen
and the app won't run. what thus it mean?

"Error building Property: SubtitleTextColor...."

err_1.PNG
Im using B4A 6.0 version.

Joey
 

chompina

Member
Licensed User
After Update to 3.52


AppCompat 3.52 + MSMaterialDrawer 0.93 combination i cannot solve.

there is a large space between Menu icon and Logo Drawable, or Menu icon and Tittle Subtittle without Logo Drawable that cause tittle and subtitle need to be more shortened.

how to short this space?? .. thanks

my config.
b4X 7.30
targetSdkVersion 27
path android jar 27
Core 7.28
Android SDK Tools 25.2.5
Android SDK Platform-tools 27
Android SDK Build-tools 27.0.2
SDK Platform 27
Android Support Repository 47
Google Play Services 46
Google Repository 58

see photos
 

Attachments

Peter Simpson

Expert
Licensed User
Are you receiving the following error message in your apps using AppCompat and B4A 7.80+

Error below copied from another users post.
B4X:
Compiling generated Java code. Error
javac 1.8.0_131
src\bz\sef\TagItNotes\main.java:17: error: cannot find symbol
public class main extends android.support.v7.app.ActionBarActivity implements B4AActivity{
^
Well if you are you should swap the original line below
B4X:
#Extends: android.support.v7.app.ActionBarActivity
With this line
B4X:
#Extends: android.support.v7.app.AppCompatActivity
@corwin42 very first post quotes the following line.
To use the AppCompat library your activities MUST extend android.support.v7.app.AppCompatActivity (extending the old android.support.v7.app.ActionBarActivity still works.)
Enjoy...
 
Last edited:

eSolution

Member
Licensed User
Are you receiving the following error message in your apps using AppCompat and B4A 7.80+

Error below copied from another users post.
B4X:
Compiling generated Java code. Error
javac 1.8.0_131
src\bz\sef\TagItNotes\main.java:17: error: cannot find symbol
public class main extends android.support.v7.app.ActionBarActivity implements B4AActivity{
^
Well if you are you should swap the original line below
B4X:
#Extends: android.support.v7.app.ActionBarActivity
With this line
B4X:
#Extends: android.support.v7.app.AppCompatActivity
@corwin42 very first post quotes the following line.


Enjoy...
I have a different error in my project now:

"
Compiling generated Java code. Error
src\com\myapp\details.java:17: error: cannot find symbol
public class details extends android.support.v7.AppCompatActivity implements B4AActivity{
^
symbol: class AppCompatActivity
location: package android.support.v7
Note: src\com\myapp\starter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error

javac 9.0.1

"
 
Last edited:

kiki78

Active Member
Licensed User
I use this library with success on an old project and now I Receive error when loading layout.
I create simplest app to understand and receive same error.
Just for information I had completely reinstall my computer due to disk crash so I reinstall all newer version.
I use BA4 9.30, AppCompat 4.00, Java SDK 1.8.0.221, android.jar 29.

Error Log :

Logger connecté à : SHi9AirQ64G18123977
--------- beginning of crash
--------- beginning of system
--------- beginning of main
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 30 (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:382)
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:869)
at android.os.Handler.dispatchMessage(Handler.java:101)
at android.os.Looper.loop(Looper.java:206)
at android.app.ActivityThread.main(ActivityThread.java:6735)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:845)
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.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:384)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:453)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
... 18 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.widget.Toolbar" on path: DexPathList[[zip file "/data/app/b4a.example-fsUbHewj_xTWg6JkfkajsQ==/base.apk"],nativeLibraryDirectories=[/data/app/b4a.example-fsUbHewj_xTWg6JkfkajsQ==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 24 more
** Activity (main) Resume **

I also try AppCompatWithDynamicMenuAndBadge from https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/ and obtain same error.

May you help me ?
 

Attachments

kelevra1602

Member
Licensed User
I use this library with success on an old project and now I Receive error when loading layout.
I create simplest app to understand and receive same error.
Just for information I had completely reinstall my computer due to disk crash so I reinstall all newer version.
I use BA4 9.30, AppCompat 4.00, Java SDK 1.8.0.221, android.jar 29.

...
Hello, you must declare the subject of your request without the action bar

you must change in your manifest:
B4X:
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat")
for:

B4X:
SetApplicationAttribute(android:theme, "@style/Theme.AppCompat.NoActionBar")
 

Erel

Administrator
Staff member
Licensed User
Download v4.00 again. It includes the jetified file which is required for AndroidX SDK. You can also create it yourself by running the jetifier tool. Make sure that the library is in the additional libraries folder and not in the internal one.
 
Top