来自AudioPlayService类onCreate()我在第168行调用以下代码.-
line168- CustomAuxEffectStats aa = CustomAuxEffectStats.getInstance();
if (aa == null) {
createCustomAuxEffect();
}
CustomAuxEffectStats类 -
public class CustomAuxEffectStats implements Serializable {
private static CustomAuxEffectStats customAuxEffectStats = null;
public static int CustomPresetID = -100;
public static final int DEFAULT_BASS_BOOST_STRENGTH = 900;
private boolean isEnabled;
private int numBands;
private int actualNumPreset;
private short selectedPreset;
private short minBandLevel;
private short maxBandLevel;
private short bassboostStrength;
private short[] bandLevels;
private String[] bandFreq;
private String[] presetNames;
private CustomAuxEffectStats(short curPreset, String[] presetNamesArr, String[] bandFreqs, short[] bandLevelRange, short[] bandlevels, boolean isEnabled) {
this.isEnabled = isEnabled;
selectedPreset = curPreset;
minBandLevel = bandLevelRange[0];
maxBandLevel = bandLevelRange[1];
numBands = bandlevels.length;
bandFreq = bandFreqs;
actualNumPreset = presetNamesArr.length - 1;
CustomPresetID = presetNamesArr.length;
presetNames = presetNamesArr;
this.bandLevels = bandlevels;
bassboostStrength = 1000;
}
public static CustomAuxEffectStats getInstance() {
return customAuxEffectStats;
}
public static CustomAuxEffectStats createInstance(short curPreset, String[] presetNamesArr, String[] bandFreqs, short[] bandLevelRange, short[] bandlevels, boolean isEnabled) {
if (customAuxEffectStats == null) {
customAuxEffectStats = new CustomAuxEffectStats(curPreset, presetNamesArr, bandFreqs, bandLevelRange, bandlevels, isEnabled);
}
return customAuxEffectStats;
}
public boolean isEnabled() {
return isEnabled;
}
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
}
public int getNumBands() {
return numBands;
}
public void setNumBands(int numBands) {
this.numBands = numBands;
}
public short getSelectedPreset() {
return selectedPreset;
}
public void setSelectedPreset(short selectedPreset) {
this.selectedPreset = selectedPreset;
}
public short getMinBandLevel() {
return minBandLevel;
}
public void setMinBandLevel(short minBandLevel) {
this.minBandLevel = minBandLevel;
}
public short getMaxBandLevel() {
return maxBandLevel;
}
public void setMaxBandLevel(short maxBandLevel) {
this.maxBandLevel = maxBandLevel;
}
public short[] getBandLevels() {
return bandLevels;
}
public void setBandLevels(short[] bandLevels) {
this.bandLevels = bandLevels;
}
public String[] getBandFreq() {
return bandFreq;
}
public void setBandFreq(String[] bandFreq) {
this.bandFreq = bandFreq;
}
public static int getCustompresetid() {
return CustomPresetID;
}
public short getBassBoostStrength() {
return bassboostStrength;
}
public void setBandLevel(short band, short progress) {
bandLevels[band] = progress;
}
public short getbandLevel(short band) {
return bandLevels[band];
}
public int getNumberOfPresets() {
return actualNumPreset;
}
public String[] getPresetNames() {
return presetNames;
}
public void setPresetNames(String[] presetNames) {
this.presetNames = presetNames;
}
public void setBassboostStrength(short bassboostStrength) {
this.bassboostStrength = bassboostStrength;
}
}
当我运行我的应用程序时,这总是在kitkat(dalvik运行时)设备上崩溃。 但它在L +(ART)设备和模拟器中工作正常。
错误日志 -
致命的例外:主要 过程:com.newwave.musicsquare,PID:26143 java.lang.VerifyError:com / newwave / musicsquare / audio / data / CustomAuxEffectStats 在com.newwave.musicsquare.services.AudioPlayService.onCreate(AudioPlayService.java:168) 在android.app.ActivityThread.handleCreateService(ActivityThread.java:2574) 在android.app.ActivityThread.access $ 1800(ActivityThread.java:141) 在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1294) 在android.os.Handler.dispatchMessage(Handler.java:102) 在android.os.Looper.loop(Looper.java:136) 在android.app.ActivityThread.main(ActivityThread.java:5113) at java.lang.reflect.Method.invokeNative(Native Method) 在java.lang.reflect.Method.invoke(Method.java:515) 在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:793) 在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 在dalvik.system.NativeStart.main(本地方法)
答案 0 :(得分:0)
所以我想通了.. 因为我正在维护这个遗产项目.. 序列化类 CustomAuxEffectStats 在构造函数中有很多引起问题的参数和很多getter,setter ...... 我删除了方法,并使所有字段级别。 从构造函数中删除所有参数... 一切都很好。