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

wes58

Active Member
Licensed User
When you use ACSpinner and click on it, in the log appears line "hasIcon: false". It shows in th log multiple times on every click. Is there any reason for it or can it be removed from the next version of the library?
 

corwin42

Expert
Licensed User
When you use ACSpinner and click on it, in the log appears line "hasIcon: false". It shows in th log multiple times on every click. Is there any reason for it or can it be removed from the next version of the library?
Yes, this is debug code which was accidentally left in the release. Will be fixed in the next version.
 

alimanam3386

Active Member
Licensed User
Hi

I use ver 3.2 of appcompact and b4a ver 6.0 when I use bellow extends in activity my app get a force close , how can I do :(

#Extends: android.support.v7.app.AppCompatActivity

When I comment above line of code , my app run ok
 

corwin42

Expert
Licensed User
Hi

I use ver 3.2 of appcompact and b4a ver 6.0 when I use bellow extends in activity my app get a force close , how can I do :(

#Extends: android.support.v7.app.AppCompatActivity

When I comment above line of code , my app run ok
If you don't use the #Extends line your app will crash if you add one of the AppCompat Views to your activity.

To get the stack trace connect the device via USB and look at the unfiltered logs (disable Filter checkmark in log window).
I'm not completely sure but if you connect with B4ABridge you may see the log (unfiltered) if you compile in debug mode.
 

alimanam3386

Active Member
Licensed User
If you don't use the #Extends line your app will crash if you add one of the AppCompat Views to your activity.

To get the stack trace connect the device via USB and look at the unfiltered logs (disable Filter checkmark in log window).
I'm not completely sure but if you connect with B4ABridge you may see the log (unfiltered) if you compile in debug mode.

Hi

I compiled in debug mode and get this exception :

B4X:
Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportWidth > 0
   at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:535)
   at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:472)
   at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:436)
   at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:708)
   at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:348)
   at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
   at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181)
   at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:689)
   at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
   at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
   at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:83)
   at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146)
   at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28)
   at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41)
   at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:193)
   at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
   at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
   at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
   at com.manamsoftware.smilepro.main.onCreate(main.java:33)
   at android.app.Activity.performCreate(Activity.java:5231)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
   at android.app.ActivityThread.access$800(ActivityThread.java:135)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5017)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
   at dalvik.system.NativeStart.main(Native Method)
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x415ec560)
FATAL EXCEPTION: main
Process: com.manamsoftware.smilepro, PID: 11137
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.manamsoftware.smilepro/com.manamsoftware.smilepro.main}: android.content.res.Resources$NotFoundException: File res/drawable-v19/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020013
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
   at android.app.ActivityThread.access$800(ActivityThread.java:135)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loop(Looper.java:136)
   at android.app.ActivityThread.main(ActivityThread.java:5017)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:515)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v19/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020013
   at android.content.res.Resources.loadDrawable(Resources.java:2096)
   at android.content.res.Resources.getDrawable(Resources.java:700)
   at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:354)
   at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
   at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:181)
   at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:689)
   at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:186)
   at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:77)
   at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:83)
   at android.support.v7.app.AppCompatDelegateImplV7.<init>(AppCompatDelegateImplV7.java:146)
   at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:28)
   at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:41)
   at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:193)
   at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:173)
   at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:511)
   at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:71)
   at com.manamsoftware.smilepro.main.onCreate(main.java:33)
   at android.app.Activity.performCreate(Activity.java:5231)
   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
   ... 11 more
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
   at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
   at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
   at android.content.res.Resources.loadDrawable(Resources.java:2092)
   ... 30 more
  Force finishing activity com.manamsoftware.smilepro/.main
GC_CONCURRENT freed 311K, 7% free 5317K/5668K, paused 2ms+1ms, total 21ms
Indexing F334C202E62F134C5D3E33814E82D69848C390E0 from com.google.android.gms
Screenshot max retries 4 of Token{41cd5208 ActivityRecord{41d5e558 u0 com.manamsoftware.smilepro/.main t43 f}} appWin=Window{4225ba10 u0 Starting com.manamsoftware.smilepro} drawState=4
Screenshot failure taking screenshot for (600x1024) to layer 21010
GC_CONCURRENT freed 474K, 8% free 6474K/6984K, paused 3ms+7ms, total 45ms
User is not opted-in to Usage & Diagnostics or Lockbox.
Indexing done F334C202E62F134C5D3E33814E82D69848C390E0
Indexing C2EE8E0B35C4CE284B59BF463F1D3E5E05CE4C9B from com.google.android.googlequicksearchbox
GC_CONCURRENT freed 466K, 9% free 5602K/6108K, paused 2ms+2ms, total 34ms
Indexing done C2EE8E0B35C4CE284B59BF463F1D3E5E05CE4C9B
Indexing F334C202E62F134C5D3E33814E82D69848C390E0 from com.google.android.gms
Indexing done F334C202E62F134C5D3E33814E82D69848C390E0
Activity pause timeout for ActivityRecord{41d5e558 u0 com.manamsoftware.smilepro/.main t43 f}
Timeline: Activity_windows_visible id: com.android.launcher time:4048603
wanglei --> mBatteryProps.batteryTemperature = 300
mHoldBootFastWakeLock = true
[CTRL_IFACE]wlan0: SIGNAL_POLL
schedule task: 2000
[CTRL_IFACE]wlan0: SIGNAL_POLL
[CTRL_IFACE]wlan0: SIGNAL_POLL
wanglei --> mBatteryProps.batteryTemperature = 300
Starting window AppWindowToken{42105518 token=Token{41cd5208 ActivityRecord{41d5e558 u0 com.manamsoftware.smilepro/.main t43}}} timed out
[CTRL_IFACE]wlan0: SIGNAL_POLL
Activity destroy timeout for ActivityRecord{41d5e558 u0 com.manamsoftware.smilepro/.main t43 f}
wanglei --> mBatteryProps.batteryTemperature = 300
mHoldBootFastWakeLock = true
[CTRL_IFACE]wlan0: SIGNAL_POLL
[193] com.google.android.finsky.c.e.run(1151): Replicating app states via AMAS.
GC_CONCURRENT freed 1340K, 19% free 6054K/7440K, paused 5ms+14ms, total 78ms
[193] com.google.android.finsky.c.c.a(311): Completed 0 account content syncs with 0 successful.
[1] com.google.android.finsky.services.j.a(149): Installation state replication succeeded.
[CTRL_IFACE]wlan0: SIGNAL_POLL
[CTRL_IFACE]wlan0: SIGNAL_POLL




 
Last edited:

corwin42

Expert
Licensed User
:) Now it's work perfect! where was the problem ?!!!
Google included the usage of Vector Drawables into the support libraries some time ago. Vector drawables are supported directly with Android 5.0 and above. Thats why it worked on your Note4.
For older Android versions the support needs to be compiled into the apk. This "magic" feature was added in v23 of the build tools.

Erel said that B4A should prefer the v23 build tools (v24 is currently not compatible with B4A). But it seems that it uses an older version if it is installed. So deinstalling all older versions forced B4A to use the 23.0.3 version and all should be fine now.

I will change the instructions in the first post that users should deinstall all older versions.
 
Top