support lib android.support.v7.widget.GridLayout causes InflateException / ClassNotFoundException with app widgets -


i'm having difficutlties use support library android.support.v7.widget.gridlayout. gives me following error:

    08-09 23:49:55.746: w/appwidgethostview(132): error inflating appwidget appwidgetproviderinfo(provider=componentinfo{com.myapp.appwidget}): android.view.inflateexception: binary xml file line #33: error inflating class android.support.v7.widget.gridlayout 08-09 23:49:56.716: w/appwidgethostview(132): updateappwidget couldn't find view, using error view 08-09 23:49:56.716: w/appwidgethostview(132): android.view.inflateexception: binary xml file line #33: error inflating class android.support.v7.widget.gridlayout 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:581) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.view.layoutinflater.rinflate(layoutinflater.java:623) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.view.layoutinflater.inflate(layoutinflater.java:408) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.view.layoutinflater.inflate(layoutinflater.java:320) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.widget.remoteviews.apply(remoteviews.java:939) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.appwidget.appwidgethostview.updateappwidget(appwidgethostview.java:218) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.appwidget.appwidgethost.updateappwidgetview(appwidgethost.java:250) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.appwidget.appwidgethost$updatehandler.handlemessage(appwidgethost.java:73) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.os.handler.dispatchmessage(handler.java:99) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.os.looper.loop(looper.java:123) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.app.activitythread.main(activitythread.java:3683) 08-09 23:49:56.716: w/appwidgethostview(132):   @ java.lang.reflect.method.invokenative(native method) 08-09 23:49:56.716: w/appwidgethostview(132):   @ java.lang.reflect.method.invoke(method.java:507) 08-09 23:49:56.716: w/appwidgethostview(132):   @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 08-09 23:49:56.716: w/appwidgethostview(132):   @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 08-09 23:49:56.716: w/appwidgethostview(132):   @ dalvik.system.nativestart.main(native method) 08-09 23:49:56.716: w/appwidgethostview(132): caused by: java.lang.classnotfoundexception: android.support.v7.widget.gridlayout in loader dalvik.system.pathclassloader[.] 08-09 23:49:56.716: w/appwidgethostview(132):   @ dalvik.system.pathclassloader.findclass(pathclassloader.java:240) 08-09 23:49:56.716: w/appwidgethostview(132):   @ java.lang.classloader.loadclass(classloader.java:551) 08-09 23:49:56.716: w/appwidgethostview(132):   @ java.lang.classloader.loadclass(classloader.java:511) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.view.layoutinflater.createview(layoutinflater.java:471) 08-09 23:49:56.716: w/appwidgethostview(132):   @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:570) 08-09 23:49:56.716: w/appwidgethostview(132):   ... 15 more 

the mentioned line #33 part support lib tag begins. looks class couldn't found reason, don't know why...

the reason why want use lib because want stay compatible android v10. no matter wether choose v10 or v4.2.2 project build target. manifest's minsdkversion set 10. followed these steps , tried putting .jar app's refferenced libraries , ticked option export it.

this layout.xml, being used create app-widget:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/appwidget_relativelayout"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparenttop="true"     android:orientation="vertical"> <textview     android:id="@+id/appwidget_textview_profilename"     android:layout_width="320dp"     android:layout_height="wrap_content"     android:layout_alignparentleft="true"     android:layout_alignparenttop="true"     android:clickable="false"     android:enabled="true"     android:gravity="center_horizontal"     android:longclickable="true"     android:scrollhorizontally="false"     android:text="profile name"     android:textappearance="?android:attr/textappearancelarge" />  <framelayout     android:id="@+id/appwidget_framelayout"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentleft="true"     android:layout_alignparentright="true"     android:layout_below="@+id/appwidget_textview_profilename" >  </framelayout>  <android.support.v7.widget.gridlayout     android:layout_width="wrap_content"     android:layout_height="wrap_content" > </android.support.v7.widget.gridlayout>  <textview     android:id="@+id/textview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="textview" /> </relativelayout> 

update: managed narrow down usage of gridlayout in connection app widgets. seems, problem occurs, when use gridlayout on them. when use same layout ordinary activity works fine. suggestions on how solve this?

when making widgets, constrained views implement remoteviews mechanism. way mechanism works remote, "host" process 1 doing actual inflating. therefore, if remote process (the launcher hosts widget) not have gridlayout class in classpath, there absolutely no way can short of drawing view in own process , setting bitmap on imageview. wouldn't that, though.

in general, when making widgets, constrain views come framework.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -