Need help, Right now, we have a production app, that is using Android DynamoDB SDK. I am trying to read a dynamodb table which has a @DynamoDBDocument. Following are my two class for table and dynamodbdocument. Now, the problem is I am getting the following crash (Attached stack trace) on few random devices. I have personally tested the same code on 10 devices, but not getting any crash. Following stack trace is from Firebase crash analytics. I am not able to find out what is the problem, why I am getting this crash. I think, it is something to do with Marshalling and unMarshalling of the nested JSON dynamodb document. The problem is it is only on few phones, and not on all phone, that's why it has become very hard for me to replicate and find a solution. Any help or directions will be highly appreciated. Many Thanks in advance.
DynamoDBMapperConfig Config = new DynamoDBMapperConfig(DynamoDBMapperConfig.ConsistentReads.EVENTUAL);
GlobalSettings mGlobalSettingsServerDB = mDynamoDBMapper.load(GlobalSettings.class, "GlobalSettings",Config);
@DynamoDBTable(tableName = "StaticContent") public class GlobalSettings {
private String Name;
private List<GlobalSettingsMap> globalSettingsMap;
@DynamoDBHashKey(attributeName = "Name")
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
@DynamoDBAttribute(attributeName="Values")
public List<GlobalSettingsMap> getGlobalSettingsMap() {
return globalSettingsMap;
}
public void setGlobalSettingsMap(List<GlobalSettingsMap> globalSettingsMap) {
this.globalSettingsMap = globalSettingsMap;
}
}
@DynamoDBDocument public class GlobalSettingsMap{
public String VariableName;
public Integer VariableValue;
@DynamoDBAttribute(attributeName = "VariableName")
public String getVariableName() {
return VariableName;
}
public void setVariableName(String variableName) {
VariableName = variableName;
}
@DynamoDBAttribute(attributeName = "VariableValue")
public Integer getVariableValue() {
return VariableValue;
}
public void setVariableValue(Integer variableValue) {
VariableValue = variableValue;
}
}
Exception java.lang.RuntimeException: An error occured while executing doInBackground()
android.os.AsyncTask$3.done (AsyncTask.java:300)
java.util.concurrent.FutureTask.finishCompletion (FutureTask.java:355)
java.util.concurrent.FutureTask.setException (FutureTask.java:222)
java.util.concurrent.FutureTask.run (FutureTask.java:242)
android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:231)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:841)
Caused by java.lang.NoClassDefFoundError: rx/Observable
java.lang.Class.getDeclaredMethods (Class.java)
java.lang.Class.getPublicMethodsRecursive (Class.java:894)
java.lang.Class.getMethods (Class.java:877)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBReflector.findRelevantGetters (DynamoDBReflector.java:72)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBReflector.getRelevantGetters (DynamoDBReflector.java:63)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.unconvert (ConversionSchemas.java:416)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.ObjectUnmarshaller.unmarshall (ObjectUnmarshaller.java:55)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.NullableUnmarshaller.unmarshall (NullableUnmarshaller.java:47)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.ListUnmarshaller.unmarshall (ListUnmarshaller.java:56)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.NullableUnmarshaller.unmarshall (NullableUnmarshaller.java:47)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.unmarshall (ConversionSchemas.java:572)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.setValue (ConversionSchemas.java:436)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.unconvert (ConversionSchemas.java:420)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.privateMarshallIntoObject (DynamoDBMapper.java:636)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load (DynamoDBMapper.java:399)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load (DynamoDBMapper.java:466)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load (DynamoDBMapper.java:331)
com.css.selfhealing.SyncData.updateGlobalSettings (SyncData.java:623)
com.css.selfhealing.SyncData.startSyncingTasks (SyncData.java:67)
com.css.selfhealing.views.HomeActivity$FetchCardsTask.doInBackground (HomeActivity.java:1103)
com.css.selfhealing.views.HomeActivity$FetchCardsTask.doInBackground (HomeActivity.java:1054)
android.os.AsyncTask$2.call (AsyncTask.java:288)
java.util.concurrent.FutureTask.run (FutureTask.java:237)
android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:231)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:841)
Caused by java.lang.ClassNotFoundException: Didn't find class "rx.Observable" on path: DexPathList[[zip file "/data/app/com.css.selfhealing-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.css.selfhealing-2, /system/lib, /system/lib/arm, /data/downloads]]
dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:56)
java.lang.ClassLoader.loadClass (ClassLoader.java:497)
java.lang.ClassLoader.loadClass (ClassLoader.java:457)
java.lang.Class.getDeclaredMethods (Class.java)
java.lang.Class.getPublicMethodsRecursive (Class.java:894)
java.lang.Class.getMethods (Class.java:877)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBReflector.findRelevantGetters (DynamoDBReflector.java:72)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBReflector.getRelevantGetters (DynamoDBReflector.java:63)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.unconvert (ConversionSchemas.java:416)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.ObjectUnmarshaller.unmarshall (ObjectUnmarshaller.java:55)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.NullableUnmarshaller.unmarshall (NullableUnmarshaller.java:47)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.ListUnmarshaller.unmarshall (ListUnmarshaller.java:56)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.unmarshallers.NullableUnmarshaller.unmarshall (NullableUnmarshaller.java:47)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.unmarshall (ConversionSchemas.java:572)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.setValue (ConversionSchemas.java:436)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.ConversionSchemas$StandardItemConverter.unconvert (ConversionSchemas.java:420)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.privateMarshallIntoObject (DynamoDBMapper.java:636)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load (DynamoDBMapper.java:399)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load (DynamoDBMapper.java:466)
com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBMapper.load (DynamoDBMapper.java:331)
com.css.selfhealing.SyncData.updateGlobalSettings (SyncData.java:623)
com.css.selfhealing.SyncData.startSyncingTasks (SyncData.java:67)
com.css.selfhealing.views.HomeActivity$FetchCardsTask.doInBackground (HomeActivity.java:1103)
com.css.selfhealing.views.HomeActivity$FetchCardsTask.doInBackground (HomeActivity.java:1054)
android.os.AsyncTask$2.call (AsyncTask.java:288)
java.util.concurrent.FutureTask.run (FutureTask.java:237)
android.os.AsyncTask$SerialExecutor$1.run (AsyncTask.java:231)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1112)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:587)
java.lang.Thread.run (Thread.java:841)
The problem here is may be you have not initialized MultiDex Option
Multidex support for Android 5.0 and higher
Android 5.0 and higher uses a runtime called ART which natively supports loading multiple dex files from application APK files. ART performs pre-compilation at application install time which scans for classes(..N).dex files and compiles them into a single .oat file for execution by the Android device. For more information on the Android 5.0 runtime, see Introducing ART. This is the reason why your app is working fine on API level 21.
Multidex support prior to Android 5.0
Versions of the platform prior to Android 5.0 use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around this limitation, you can use the multidex support library, which becomes part of the primary DEX file of your app and then manages access to the additional DEX files and the code they contain.
So, Firstly making sure you have imported correct dependency
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
In your manifest add the MultiDexApplication class from the multidex support library to the application element.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
// This will solved the problem
android:name="YourAppName">
...
</application>
</manifest>
You can also try this
public class YouAppName extends MultiDexApplication {
.. ..
}
All the best.
from RxJava noClassDefFoundError: rx.plugins.RxJavaPlugins on API 16