Android NoSuchMethodException: callDrawGLFunction - android

I find the method is reanme to callDrawGLFunction2 at the android version of 5.1.0 . And add the class of com.android.webview.chromium.WebViewDelegateFactory at the same time.
But i don't know how to fix the bug. can anyone have idea.
full stack:
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
... 25 more
Caused by: android.util.AndroidRuntimeException: java.lang.RuntimeException: Invalid reflection
at android.webkit.WebViewFactory.getProvider(WebViewFactory.java)
at android.webkit.WebView.getFactory(WebView.java)
at android.webkit.WebView.ensureProviderCreated(WebView.java)
at android.webkit.WebView.setOverScrollMode(WebView.java)
at android.view.View.init(View.java)
at android.view.View.init(View.java)
at android.view.ViewGroup.init(ViewGroup.java)
at android.widget.AbsoluteLayout.init(AbsoluteLayout.java)
at android.webkit.WebView.init(WebView.java)
at android.webkit.WebView.init(WebView.java)
at android.webkit.WebView.init(WebView.java)
at android.webkit.WebView.init(WebView.java)
... 27 more
Caused by: java.lang.RuntimeException: Invalid reflection
at com.android.webview.chromium.WebViewDelegateFactory$Api21CompatibilityDelegate.init(WebViewDelegateFactory.java:258)
at com.android.webview.chromium.WebViewChromiumFactoryProvider.init(WebViewChromiumFactoryProvider.java:2106)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1690)
... 39 more
Caused by: java.lang.NoSuchMethodException: callDrawGLFunction [long]
at java.lang.Class.getMethod(Class.java:671)
at com.android.webview.chromium.WebViewDelegateFactory$Api21CompatibilityDelegate.init(WebViewDelegateFactory.java:246)
... 42 more
android.view.InflateException: Binary XML file line #21: Error inflating class android.webkit.WebView
at android.view.LayoutInflater.createView(LayoutInflater.java)

It's not application error.
The bug is all report from the device of sdk 22. But the method is already rename in that version.
I send email to google developer who rename the method from callDrawGLFunction to callDrawGLFunction2. I got some reply:
"Api21CompatibilityDelegate means webview believes it's running on 21. Renaming callDrawGLFunction happened after API21, hence webview is trying look for the old name."
So It's obvious device rom bug.

Related

Android app not working on android 6 (marshmallow) but working on other android versions classNotFoundException

I am trying to make an HTTP call to a server to get its HTML contents everything is working fine on other android versions. But in android 6 when the app is calling HTMLunit it crashes.
I know it has to do with something that works on API above 23. but not on the 23.. I tried many things but I sill can't fix it...
Why it's important to run the app on android 6:
A big number of my users is using android 6 and 5
The error:
FATAL EXCEPTION: Thread-9255
Process: bd.maruf.myapplication, PID: 7773
java.lang.NoClassDefFoundError: java.util.function.Supplier
at libcore.reflect.InternalNames.getClass(InternalNames.java:55)
at java.lang.Class.getDexCacheType(Class.java:476)
at java.lang.reflect.Method.getReturnType(Method.java:183)
at java.lang.Class.getDeclaredMethods(Class.java:678)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:212)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:193)
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:67)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:685)
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:701)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:161)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:326)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:275)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:265)
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:257)
at bd.maruf.myapplication.MainActivity.main(MainActivity.kt:32)
at bd.maruf.myapplication.MainActivity.onCreate$lambda$1$lambda$0(MainActivity.kt:22)
at bd.maruf.myapplication.MainActivity.$r8$lambda$VtPJx1mT1BVGpp5vWQWqcx_e4kM(MainActivity.kt)
at bd.maruf.myapplication.MainActivity$$ExternalSyntheticLambda2.run(D8$$SyntheticClass)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.util.function.Supplier" on path: DexPathList[[zip file "/data/app/bd.maruf.myapplication-1/base.apk"],nativeLibraryDirectories=[/data/app/bd.maruf.myapplication-1/lib/arm, /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)
at libcore.reflect.InternalNames.getClass(InternalNames.java:53)
at java.lang.Class.getDexCacheType(Class.java:476) 
at java.lang.reflect.Method.getReturnType(Method.java:183) 
at java.lang.Class.getDeclaredMethods(Class.java:678) 
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:212) 
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:193) 
at com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:67) 
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:685) 
at com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:701) 
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:161) 
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:326) 
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:275) 
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:265) 
at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:257) 
at bd.maruf.myapplication.MainActivity.main(MainActivity.kt:32) 
at bd.maruf.myapplication.MainActivity.onCreate$lambda$1$lambda$0(MainActivity.kt:22) 
at bd.maruf.myapplication.MainActivity.$r8$lambda$VtPJx1mT1BVGpp5vWQWqcx_e4kM(MainActivity.kt) 
at bd.maruf.myapplication.MainActivity$$ExternalSyntheticLambda2.run(D8$$SyntheticClass) 
at java.lang.Thread.run(Thread.java:818) 
Suppressed: java.lang.ClassNotFoundException: java.util.function.Supplier
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)
... 20 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
2022-11-12 18:11:50.861 7773-7807 Surface bd.maruf.myapplication D Surface::disconnect(this=0xaddb7b00,api=1)
what I have tried :
cleaning and rebuilding that project
adding:
defaultConfig { multiDexEnabled true}
dependencies {implementation 'com.android.support:multidex:1.0.3'
3. deleting .gradel and .idea file
java.util.function.Supplier is documented as "Added in API level 24", hence code requiring it will not work on pre 24 SDK due to class absence.
Will try to solve this in HtmlUnit - check https://github.com/HtmlUnit/htmlunit-android/issues/9 or https://twitter.com/htmlunit for progress.
After some analysis and experiments i decide to not fix this. The js engine (Rhino) uses classes from the java.util.function package. Changing this is not a simple task and there are many other thinks to do.
So sorry, but i like to stay with android 7 as minimum requirement.

long SVG Asset file error : R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE

I'm having some problems with Android Studio at the moment because I recently started using "Vector Assets". I've done absolutely everything necessary to display them correctly in my application (using the app:srcCompat="" in the xml, android {defaultConfig {vectorDrawables.useSupportLibrary true}} in the build.gradle, and AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); in the onCreate() method before setContentView()).
The svg files I imported into Android Studio do not have errors themselves, I can see the result without any problem in an ImageView with the wizard. The only problem comes when I run my application and it arrives at the time to draw the svg. Some of my svg's still work, while others don't, so I think some of them take too long to process.
Here is the error :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.retroverse.bataille_corse, PID: 18807
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.retroverse.bataille_corse/com.retroverse.bataille_corse.MenuPrincipal}: android.view.InflateException: Binary XML file line #127: Binary XML file line #127: Error inflating class ImageView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2985)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3120)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: android.view.InflateException: Binary XML file line #127: Binary XML file line #127: Error inflating class ImageView
Caused by: android.view.InflateException: Binary XML file line #127: Error inflating class ImageView
Caused by: android.content.res.Resources$NotFoundException: Drawable com.retroverse.bataille_corse:drawable/card_49_en with resource ID #0x7f060099
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/card_49_en.xml from drawable resource ID #0x7f060099
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:854)
at android.content.res.ResourcesImpl.loadDrawable(ResourcesImpl.java:634)
at android.content.res.MiuiResourcesImpl.loadDrawable(MiuiResourcesImpl.java:329)
at android.content.res.Resources.getDrawableForDensity(Resources.java:902)
at android.content.res.Resources.getDrawable(Resources.java:841)
at android.content.Context.getDrawable(Context.java:644)
at androidx.core.content.ContextCompat.getDrawable(ContextCompat.java:454)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:144)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:104)
at androidx.appcompat.widget.AppCompatImageHelper.loadFromAttributes(AppCompatImageHelper.java:59)
at androidx.appcompat.widget.AppCompatImageView.<init>(AppCompatImageView.java:78)
at androidx.appcompat.widget.AppCompatImageView.<init>(AppCompatImageView.java:68)
at androidx.appcompat.app.AppCompatViewInflater.createImageView(AppCompatViewInflater.java:187)
at androidx.appcompat.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:107)
at androidx.appcompat.app.AppCompatDelegateImpl.createView(AppCompatDelegateImpl.java:1407)
at androidx.appcompat.app.AppCompatDelegateImpl.onCreateView(AppCompatDelegateImpl.java:1457)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:776)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:867)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
at android.view.LayoutInflater.inflate(LayoutInflater.java:519)
at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:555)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
at com.retroverse.bataille_corse.MenuPrincipal.onCreate(MenuPrincipal.java:24)
at android.app.Activity.performCreate(Activity.java:7232)
E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:7221)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1272)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2965)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3120)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1840)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
Caused by: java.lang.IllegalArgumentException: R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE
at android.util.PathParser.nCreatePathDataFromString(Native Method)
at android.util.PathParser.access$200(PathParser.java:24)
at android.util.PathParser$PathData.<init>(PathParser.java:76)
at android.graphics.drawable.VectorDrawable$VFullPath.updateStateFromTypedArray(VectorDrawable.java:2016)
at android.graphics.drawable.VectorDrawable$VFullPath.inflate(VectorDrawable.java:1967)
at android.graphics.drawable.VectorDrawable.inflateChildElements(VectorDrawable.java:819)
at android.graphics.drawable.VectorDrawable.inflate(VectorDrawable.java:717)
at android.graphics.drawable.DrawableInflater.inflateFromXmlForDensity(DrawableInflater.java:142)
at android.graphics.drawable.Drawable.createFromXmlInnerForDensity(Drawable.java:1332)
at android.graphics.drawable.Drawable.createFromXmlForDensity(Drawable.java:1291)
at android.content.res.ResourcesImpl.createFromXmlForDensity(ResourcesImpl.java:1506)
at android.content.res.ResourcesImpl.loadDrawableForCookie(ResourcesImpl.java:838)
... 41 more
The most important line, I think, is Caused by: java.lang.IllegalArgumentException: R is not a valid verb. Failure occurred at position 2 of path: STRING_TOO_LARGE.
We also know that this svg was caught in the middle (its size is 187 kilobytes). So I think my SVG file (even imported in Android Studio by "Vector Asset") is too heavy.
As we are told here, the STRING_TOO_LARGE issue appears when the string "is longer than 0x7FFF = 32767 characters". (In the reproduction part)
Indeed, the only svg to work in my application are lighter than 32 kb, which could explain this.
But I really need to display this svg (don't offer to convert it to png!) correctly, and if possible without optimizing its paths.
Any help would be welcome!
I found the answer (at last...).
Actually, there is no real problem with Vector Assets over 32 kb, it all depends on what is in the code. I should have paid more attention to the warnings than usual I don't always look at...
I discovered inside my svg a path data with a path of more than 40kb (in one string so). The fact is that, according to the site in the question, a String can't have more than (about) 32k characters or the whole string used in any xml file will be replaced by "STRING_TOO_LARGE". Anyway, by just removing this line here, I can draw the vector perfectly well (while it is still 250 kb, but now incomplete).
What's quite surprising is that Android Studio only displays a warning (where the string is longer than 32k characters) just to make me understand that an svg with a long path can be slow to display, instead of warning me that the path will be corrupted because it's too long (or even better turn this warning into an error in the IDE, to avoid an unpleasant surprise).
Thanks to #TheBigBadBoy I splitted long SVG path into several segments. I opened XML file of the image and divided the path by M symbol (see also how to split one path into two paths in svg).
<path
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:pathData="M40.255,47.8897C40.1686, ... ,47.8897ZM38.7713,40.2642L38.8362, ..., 46.0978Z"
/>
You can see that each segment starts with M and ends with Z. You can retain about 20Kb in the first path and cut the tail. Then paste the tail into the second path. Make so many paths that all of them become less than 32 Kb.
So, you will get:
<path
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:pathData="M40.255,47.8897C40.1686, ... ,47.8897Z"
/>
<path
android:fillColor="#ffffff"
android:fillType="evenOdd"
android:pathData="M38.7713,40.2642L38.8362, ..., 46.0978Z"
/>

Android dagger api 21 compatibility

I developed app with dagger library on api version 25. But now I tried app on 21 api version and it doesn't working. It's caused by dagger.
Here is error log:
java.lang.NoClassDefFoundError: Failed resolution of: Ldagger/internal/Preconditions;
Caused by: java.lang.ClassNotFoundException: Didn't find class "dagger.internal.Preconditions" on path: DexPathList[[zip file "/data/app/package-2/base.apk"],nativeLibraryDirectories=[/data/app/package-2/lib/x86, /vendor/lib, /system/lib]]
My dagger version: 2.11-rc1.
Where is the problem?
Thanks
Solved by update build tools version

Olingo OData 2.0 for Android - Dependency to javax.xml.stream.XMLInputFactory

I tried to implement an OData V2 Client using Apache Olingo OData 2.0 in Android.
Executing the client class as java class works fine, but I cannot run the Android App using the same code in an AsyncTask:
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: com.my.app.appname, PID: 2521
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:300)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.conurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
java.util.conurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/stream/XMLInputFactory;
at org.apache.olingo.odata2.core.commons.XmlHelper.createStreamReader(XmlHelper.java:41)
org.apache.olingo.odata2.core.edm.provider.EdmxProvider.parse(EdmxProvider.java:50)
org.apache.olingo.odata2.core.ep.ProviderFacadeImpl.readMetadata(ProviderFacadeImpl.java:224)
org.apache.olingo.odata2.api.ep.EntityProvider.readMetadata(EntityProvider.java:844)
at connectivity.MyClass.doInBackground(MyClass.java:153)
at connectivity.MyClass.doInBackground(MyClass.java:38)
at android.os.AsyncTask$2.call(AsyncTask.java:288)
at java.util.concurrent.FutureTask.run(FutureTask.java:237) <4 more...>
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.xml.stream.XMLInputFactory" on path: DexPathList[[zip file "/data/app/com.my.app.appname-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) <12 more...>
Suppressed: java.lang.ClassNotFoundException: javax.xml.stream.XmlInputFactory
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.findClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
My questions are:
(How) Can I fix this issue?
(I read somewhere that the missing class might not be supported by Android?)
Would it help to switch to Apache Olingo OData 4.0?
(I need to consume an OData V2 service and if Olingo V4 would suport this on Android, I might try to migrate my client...)
Thanks in advance!
You have to repackage the javax.xml.stream classes yourself since Android does not support XML. Olingo V4 has a special android packaged client for that on the V4 dowload page: http://olingo.apache.org/doc/odata4/download.html
Olingo V2 does not have this feature because when the V2 library was created the main focus was on server side implementations. This is why a lot of convenience on client side is missing.

FileNotFoundException for drawable in drawable-xhdpi-v4

We got a crash log from Google Play and it seems some drawable in drawable-xhdpi-v4 is not found. However, we didn't have a drawable-xhdpi-v4 folder and do have edit_bg.9.png in res/drawable-xhdpi/. I found this post after searching, but it seems not helpful and no accepted answers there.
Thanks for any advice.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xhdpi-v4/edit_bg.9.png from drawable resource ID #0x7f0200bb
at android.content.res.Resources.loadDrawable(Resources.java:2172)
at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
at android.view.View.<init>(View.java:3589)
at android.widget.TextView.<init>(TextView.java:642)
at android.widget.EditText.<init>(EditText.java:60)
at android.widget.EditText.<init>(EditText.java:56)
... 29 more
Caused by: java.io.FileNotFoundException: res/drawable-xhdpi-v4/edit_bg.9.png
at android.content.res.AssetManager.openNonAssetNative(Native Method)
at android.content.res.AssetManager.openNonAsset(AssetManager.java:421)
at android.content.res.Resources.loadDrawable(Resources.java:2163)
... 34 more

Categories

Resources