I'm developing an Android application that uses a very, very large third-party Java library (netcdf-java). The library makes extensive use of Java 8 features, particularly lambda expressions.
The application works fine on Oreo/API 25+, but crashes and burns on API 21-24 (21 was the oldest I bothered to try testing) with an error that appears to be a NoClassDefFoundError involving lambdas, after a bunch of failed classloads that I've read basically mean, "This version of Android can't do lambdas":
06-14 15:43:05.395 8010-8127/pantherkitty.launchspotter I/art: Rejecting re-init on previously-failed class java.lang.Class<ucar.nc2.-$$Lambda$Group$oysUYWnjlRBOBg2TJn5tet0MooM>
(... snip ...)
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ caught exception while parsing GriddedData for /data/user/0/pantherkitty.launchspotter/cache/abi-l2-acmc-57529695.nc : java.io.IOException: java.lang.NoClassDefFoundError: ucar.nc2.-$$Lambda$Group$oysUYWnjlRBOBg2TJn5tet0MooM
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ at ucar.nc2.NetcdfFile.open(NetcdfFile.java:401)
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ at ucar.nc2.dataset.NetcdfDataset.openProtocolOrFile(NetcdfDataset.java:831)
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:479)
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ at ucar.nc2.dataset.NetcdfDataset.acquireDataset(NetcdfDataset.java:634)
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:86)
06-14 15:43:05.397 8010-8127/pantherkitty.launchspotter E/PRETTY_LOGGER: │ at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:72)
I've read that Google supposedly tweaked Android Studio/Gradle to make Java 8 features backwards-compatible with older devices limited to earlier APIs. Theory aside... I've never seen it actually work, despite using the latest version of Android Studio, upgrading the project to Gradle 3, targeting API=30 (with min API=21), and specifying JavaVersion.VERSION_1_8 for sourceCompatibility and targetCompatibility in build.gradle.
So... is there something else I need to do to enable unfettered Lambda-usage by Android apps running under API 21-24, or is 100% backwards-compatibility with lambdas and older Android devices with only API 21-24 (Lollipop, Marshmallow, and Nougat) something that still doesn't work... and probably won't ever work?
update: I applied Artem Viter's suggestions.
I'm no longer getting the "rejecting re-init on previously failed class" or the "NoClassDefFound" errors for classes that appeared to be lambda-related earlier, but now I'm getting some new errors that are even more mystifying.
I'm not sure whether this is just a new manifestation of my original problem (say, if I'm just seeing an error message arising from desugared code that ultimately boils down to the same thing), or whether this is something completely new and different that ought to have a different question here.
(note: I'm testing it on a Chuwi Hi12 tablet with Intel Cherry Trail SoC and Android 5.1, which might explain the Intel-related errors)
06-14 18:56:35.783 17016-17677/pantherkitty.launchspotter W/art: Failed to open zip archive '/system/framework/com.intel.config.jar': I/O Error
06-14 18:56:35.783 17016-17677/pantherkitty.launchspotter W/art: Failed to open zip archive '/system/framework/com.intel.aware.awareservice.jar': I/O Error
06-14 18:56:35.900 17016-17677/pantherkitty.launchspotter W/art: Failed to open zip archive '/system/framework/com.intel.config.jar': I/O Error
06-14 18:56:35.900 17016-17677/pantherkitty.launchspotter W/art: Failed to open zip archive '/system/framework/com.intel.aware.awareservice.jar': I/O Error
06-14 18:56:35.970 17016-17677/pantherkitty.launchspotter E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
Process: pantherkitty.launchspotter, PID: 17016
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
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.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/invoke/MethodHandles;
at ucar.nc2.dataset.EnhanceScaleMissingUnsignedImpl.<clinit>(EnhanceScaleMissingUnsignedImpl.java:30)
at ucar.nc2.dataset.VariableDS.<init>(VariableDS.java:761)
at ucar.nc2.dataset.NetcdfDataset.convertVariable(NetcdfDataset.java:1172)
at ucar.nc2.dataset.NetcdfDataset.convertGroup(NetcdfDataset.java:1156)
at ucar.nc2.dataset.NetcdfDataset.<init>(NetcdfDataset.java:1139)
at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:485)
at ucar.nc2.dataset.NetcdfDataset.acquireDataset(NetcdfDataset.java:634)
at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:86)
at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:72)
at pantherkitty.launchspotter.GriddedData.update(GriddedData.java:45)
at pantherkitty.launchspotter.MapsActivity$GriddedDataParserTask.doInBackground(MapsActivity.java:242)
at pantherkitty.launchspotter.MapsActivity$GriddedDataParserTask.doInBackground(MapsActivity.java:221)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.invoke.MethodHandles" on path: DexPathList[[zip file "/data/app/pantherkitty.launchspotter-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)
at ucar.nc2.dataset.EnhanceScaleMissingUnsignedImpl.<clinit>(EnhanceScaleMissingUnsignedImpl.java:30)
at ucar.nc2.dataset.VariableDS.<init>(VariableDS.java:761)
at ucar.nc2.dataset.NetcdfDataset.convertVariable(NetcdfDataset.java:1172)
at ucar.nc2.dataset.NetcdfDataset.convertGroup(NetcdfDataset.java:1156)
at ucar.nc2.dataset.NetcdfDataset.<init>(NetcdfDataset.java:1139)
at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:485)
at ucar.nc2.dataset.NetcdfDataset.acquireDataset(NetcdfDataset.java:634)
at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:86)
at ucar.nc2.dt.grid.GridDataset.open(GridDataset.java:72)
at pantherkitty.launchspotter.GriddedData.update(GriddedData.java:45)
at pantherkitty.launchspotter.MapsActivity$GriddedDataParserTask.doInBackground(MapsActivity.java:242)
at pantherkitty.launchspotter.MapsActivity$GriddedDataParserTask.doInBackground(MapsActivity.java:221)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Suppressed: java.lang.ClassNotFoundException: java.lang.invoke.MethodHandles
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)
... 19 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
update 2:
I got the same crash on my Galaxy S3 (running AOSP Marshmallow), but without the four W/art errors related to Intel jarfiles I got on the tablet. The details of the crash itself were substantially identical after that.
Related
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.
I'm working on a React Native project that uses djinni to use cross platform native C++.
I already looked at this question, but it seems a different problem.
The project build successfully but fails almost immediately on run.
adb logcat shows the following exception:
No implementation found for com.djinnius.HelloWorld$CppProxy com.djinnius.HelloWorld.create(com.rushingvise.reactcpp.ReactBridge) (tried Java_com_djinnius_HelloWorld_create and Java_com_djinnius_HelloWorld_create__Lcom_rushingvise_reactcpp_ReactBridge_2)
I'm trying to understand what tried means in the message above. Is this because the corresponding native code is missing from the apk ? Or maybe another cause ?
Full logcat is following:
04-19 19:44:51.042 2354-2700/com.djinnius E/art: No implementation found for com.djinnius.HelloWorld$CppProxy com.djinnius.HelloWorld.create(com.rushingvise.reactcpp.ReactBridge) (tried Java_com_djinnius_HelloWorld_create and Java_com_djinnius_HelloWorld_create__Lcom_rushingvise_reactcpp_ReactBridge_2)
04-19 19:44:51.045 2354-2354/com.djinnius W/unknown:React: Caught exception after cancelling react context init
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object com.facebook.react.ReactInstanceManager$Result.get()' on a null object reference
at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.onCancelled(ReactInstanceManager.java:247)
at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.onCancelled(ReactInstanceManager.java:197)
at android.os.AsyncTask.finish(AsyncTask.java:665)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6339)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1084)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:945)
04-19 19:44:51.053 2354-2700/com.djinnius E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #3
Process: com.djinnius, PID: 2354
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:325)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.UnsatisfiedLinkError: No implementation found for com.djinnius.HelloWorld$CppProxy com.djinnius.HelloWorld.create(com.rushingvise.reactcpp.ReactBridge) (tried Java_com_djinnius_HelloWorld_create and Java_com_djinnius_HelloWorld_create__Lcom_rushingvise_reactcpp_ReactBridge_2)
at com.djinnius.HelloWorld.create(Native Method)
at com.djinnius.HelloWorld.<init>(HelloWorld.java:27)
at com.djinnius.HelloWorldPackage.createNativeModules(HelloWorldPackage.java:18)
at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:88)
at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:950)
at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:891)
at com.facebook.react.ReactInstanceManager.access$600(ReactInstanceManager.java:104)
at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:218)
at com.facebook.react.ReactInstanceManager$ReactContextInitAsyncTask.doInBackground(ReactInstanceManager.java:197)
at android.os.AsyncTask$2.call(AsyncTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
Any help appreciated.
Found the problem.
It was indeed a missing System.LoadLibrary() Call in the Java Class extending ReactPackage.
This is working now with this class initializer
public class HelloWorldPackage implements ReactPackage {
static {
System.loadLibrary("native-lib");
}
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.
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.
The latest update to the Microsoft Health application appears to have broken backwards compatibility with the SDK preview resulting in errors similar to the following for Android development:
04-28 20:02:09.001 8840-9755/org.hackerforhire.msbandlight E/AndroidRuntime﹕ FATAL EXCEPTION: f
Process: org.hackerforhire.msbandlight, PID: 8840
java.lang.RuntimeException: Parcel android.os.Parcel#1d1d95f2: Unmarshalling unknown type code 40 at offset 368
at android.os.Parcel.readValue(Parcel.java:2228)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2485)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.Bundle.getParcelable(Bundle.java:755)
at com.microsoft.band.f.d(SourceFile:820)
at com.microsoft.band.f.d(SourceFile:40)
at com.microsoft.band.f$d.a(SourceFile:892)
at com.microsoft.band.internal.e$3.handleMessage(SourceFile:137)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at com.microsoft.band.internal.e.run(SourceFile:148)
I previously assumed this was an issue with ProGuard rules per this stack overflow; however, that did not have any impact.
At this point, I'm really looking to see if anyone can suggest a good way to dig into the library JAR and see if there's something I can manually patch to get things working. Is there such a thing or is it best to just hope that Microsoft will release a new SDK soon?
Version information:
Microsoft Health Version: 1.3.10427.2
Microsoft Band SDK Version: 1.3.10215.1
Microsoft Band Firmware Version: 10.2.2810.0 09 R
Android Version: 5.1 (Nexus 6)
UPDATE 2015-04-30: Confirmed that the newest version of the SDK (1.3.10428.1) resolves this issue.
I'm afraid I don't have a solution, but can confirm the problem. I have hit the same problem today. My Xamarin.Forms Android build interfacing to Microsoft Band was working fine yesterday. Now it's dead - the call to BandClient.ConnectTaskAsync() never completes. Even the sample app fails to connect.
My app is using:
Microsoft.Band.Android 1.3.10215.1
Microsoft.Band.Portable 1.0.0.0
I am testing on a Motorola Moto E running Android 4.4.4
using a Microsoft Band with Firmware Version: 10.2.2810.0 09 R
The output from the debugger (from the sample app) follows:
FATAL EXCEPTION: f
Process: Microsoft.Band.Sample, PID: 9382
java.lang.RuntimeException: Parcel android.os.Parcel#4193eec8: Unmarshalling unknown type code 3473459 at offset 344
at android.os.Parcel.readValue(Parcel.java:2080)
at android.os.Parcel.readSparseArrayInternal(Parcel.java:2363)
at android.os.Parcel.readSparseArray(Parcel.java:1735)
at android.os.Parcel.readValue(Parcel.java:2070)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2313)
at android.os.Bundle.unparcel(Bundle.java:249)
at android.os.Bundle.getParcelable(Bundle.java:1206)
at com.microsoft.band.f.d(SourceFile:820)
at com.microsoft.band.f.d(SourceFile:40)
at com.microsoft.band.f$d.a(SourceFile:892)
at com.microsoft.band.internal.e$3.handleMessage(SourceFile:137)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at com.microsoft.band.internal.e.run(SourceFile:148)
CURRENT freed 23K, 17% free 36752K/43852K, paused 4ms+23ms, total 113ms
Activity microsoft.band.sample.MainActivity has leaked ServiceConnection com.microsoft.band.f$1#41aa1438 that was originally bound here
android.app.ServiceConnectionLeaked: Activity microsoft.band.sample.MainActivity has leaked ServiceConnection com.microsoft.band.f$1#41aa1438 that was originally bound here
at com.micros04-29 17:21:27.607 E/ActivityThread( 9382): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:979)
at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:873)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1690)
at android.app.ContextImpl.bindService(ContextImpl.java:1673)
at android.content.ContextWrapper.bindService(ContextWrapper.java:517)
at com.microsoft.band.f.f(SourceFile:330)
at com.microsoft.band.a.connect(SourceFile:106)
at mono.android.view.View_OnClickListenerImplementor.n_onClick(Native Method)
at mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:29)
at android.view.View.performClick(View.java:4456)
at android.view.View$PerformClick.run(View.java:18465)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)