I started seeing this exception pop up in Logcat logs.
java.lang.ArrayIndexOutOfBoundsException: length=18; index=18
com.symbol.emdk.EMDKResults.getExtStatusCodeFromXMLString(EMDKResults.java:516)
com.symbol.emdk.EMDKResults.(EMDKResults.java:330)
com.symbol.emdk.ProfileManager.processProfile(ProfileManager.java:296)
com.qvs.androidshell.devices.EmdkDevices.activateProfile(EmdkDevices.java:81)
com.qvs.androidshell.devices.EmdkDevices$1.run(EmdkDevices.java:62)
Anyone else see it or know what it is?
ArrayIndexOutOfBoundsException |
5 Replies
Hi John,
Above exception is written when the parameters are invalid in to the processProfile API call. As per your code snippets given, they are correct.
Further i added your xml into the ProfileDataCaptureSample1 and ran the same four profiles. it worked. Could you please run the same sample attached and see if the Logcat shows a failure in particular log messages? If so please share them.
EMDKResults results = profileManager.processProfile("ScanOffMsrOn", ProfileManager.PROFILE_FLAG.SET, (String[]) null);
Log.e("TEST", "AAAA1: " + results.getStatusString());
results = profileManager.processProfile("ScanOnMsrOff", ProfileManager.PROFILE_FLAG.SET, (String[]) null);
Log.e("TEST", "AAAA2: " + results.getStatusString());
results = profileManager.processProfile("ScanOffMsrOn", ProfileManager.PROFILE_FLAG.SET, (String[]) null);
Log.e("TEST", "AAAA3: " + results.getStatusString());
results = profileManager.processProfile("ScanOnMsrOn", ProfileManager.PROFILE_FLAG.SET, (String[]) null);
Log.e("TEST", "AAAA4: " + results.getStatusString());
If this is working, then you may need to compare the differences when you call the above APIs.
Thanks,
Charith.
Hi John,
Could you please replace "(String[]) null" with "new String[1]" and let us know the result?
Thanks,
Charith.
Hey John, The logs you've posted are not enough to debug the issue. Could you provide more, or some example code that exhibits this issue?
Hi Bill,
A little background here. I was running into problems using the processProfile
API to dynamically enable and disable the barcode scanner and MSR.
See this issue: https://developer.zebra.com/thread/30543
Please note Rob Galvin's suggested method to get the behavior I needed. This
is the solution I implemented.
I was told by someone (can't remember who) that I would need to processProfile()
on each of my four profiles at app initialization time. I beleive this is
becuase there is no way for my app to know if the profiles are already loaded
into the device.
I just spark up a thread when my app is opened and processProfile on each
of the four. This is where the exception is thrown. The calls to
activateProfile("ScanOffMsrOn");
and
activateProfile("ScanOnMsrOn");
trigger the exception.
The MSR is not attached in these scenarios.
@Override
public void onOpened(EMDKManager emdkManager) {
baseLog(Level.DEBUG, "EMDKListener.onOpened");
this.profileManager = (ProfileManager) emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE);
new Thread(new Runnable() {
@Override
public void run() {
baseLog(Level.DEBUG, "Starting profile initialization");
activateProfile("ScanOffMsrOff");
activateProfile("ScanOnMsrOff");
activateProfile("ScanOffMsrOn");
activateProfile("ScanOnMsrOn");
setDefaultProfile();
activateProfileWithIntent(makeProfileName());
baseLog(Level.DEBUG, "profile initialization complete");
}
}).start();
}
Here is the code for activateProfile()
public void activateProfile(String profileName) {
if (profileManager != null) {
EMDKResults results = profileManager.processProfile(profileName, ProfileManager.PROFILE_FLAG.SET, (String[]) null);
baseLog(Level.DEBUG, "processProfile(" + profileName + ") status code " + results.statusCode + " msg: " + results.getStatusString());
}
}
Also, here is my config