枚举字段上的ActiveAndroid NoClassDefFoundError异常

时间:2017-07-11 12:16:03

标签: java android activeandroid

在Android 4.3的Galaxy Nexus上只发生过一次。 在具有枚举字段的Active Android中是否存在一些已知问题? 谷歌没有帮助,我甚至不确定在哪里看。

我必须提到我有multiDexEnabled = true,这可能是ActiveAndroid在这个奇怪的地方搜索类的原因(my_app_name-1.apk)

Private Sub Remove_incomplete_records_Click()
Dim n, count As Integer
Dim i As Long
Dim lastrownum As Integer
Dim rngU As Range

    lastrownum = Sheets("Master_Data").Cells(Rows.count, 1).End(xlUp).Row

    Dim varCalcmode
    Application.ScreenUpdating = False

    Do While (lastrownum)

        'for NB,FO etc if field your refernence is not present then delete the entire row.
        For i = 2 To lastrownum
            If (Sheets("Master_Data").Cells(i, 2).Value <> "YC" And Sheets("Master_Data").Cells(i, 2).Value <> "YK" And Sheets("Master_Data").Cells(i, 2).Value <> "MK" And Cells(i, 2).Value <> "WK" And Sheets("Master_Data").Cells(i, 2).Value <> "AN") Then
                If (Sheets("Master_Data").Cells(i, 4).Value = "") Then
                    'On Error Resume Next
                    With Sheets("Master_Data")
                        If rngU Is Nothing Then
                            Set rngU = .Range("a" & i)
                        Else
                            Set rngU = Union(rngU, .Range("a" & i))
                        End If
                    End With
                    'Sheets("Master_Data").Rows(i).EntireRow.Delete Shift:=xlUp
                    'varCalcmode = Application.Calculation
                    'Application.Calculation = xlCalculationManual
                    'Application.ScreenUpdating = False
                Else
                End If
            Else
            End If
        Next i
    Loop
    rngU.EntireRow.Delete
    'Application.Calculation = varCalcmode
    'Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True

End Sub

1 个答案:

答案 0 :(得分:1)

根据MultiDex documentation,您需要从应用程序中调用MultiDex.install(this)

  

通过附加从应用程序apk加载的额外dex文件来修补应用程序上下文类加载器。

您可以通过扩展MultiDexApplication类:

来实现此目的
public class MyApplication extends MultiDexApplication { ... }

或者,如果你有自己的自定义Application类,它已经扩展了其他东西,直接调用install

public class MyApplication extends SomeOtherApplication {
  @Override
  protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
  }
}

为什么我们只需要为4.4及以下版本执行此操作?如果我们look at the docs again我们可以看到MultiDex支持内置于Android 5.0(L)及更高版本:

  

Android 5.0(API级别21)及更高版本使用名为ART的运行时,它本身支持从APK文件加载多个DEX文件。

实际上,如果我们进入MultiDex支持库,我们可以看到如果设备VM被认为是&#34;多dex能够&#34;:

public static void install(Context context) {
    Log.i("MultiDex", "install");
    if(IS_VM_MULTIDEX_CAPABLE) {
        Log.i("MultiDex", "VM has multidex support, MultiDex support library is disabled.");
    } else if(VERSION.SDK_INT < 4) {
        throw new RuntimeException("Multi dex installation failed. SDK " + VERSION.SDK_INT + " is unsupported. Min SDK version is " + 4 + ".");
    } else {
        // Set up multidex
        ...
    }
}