只有Mi pad在运行应用程序时出现该问题。 为了解决我遇到的问题 1.卸载该应用,然后重试连接,但出现相同的错误 2.在我的android studio中禁用即时运行 3.构建gradle中的用户多办公桌
其他项目正在同一标签中的同一Android Studio中工作
任何人都知道如何解决该问题。
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.uncommonsense, PID: 23808
java.lang.RuntimeException: Unable to instantiate application .application.ApplicationDetails: java.lang.ClassNotFoundException: Didn't find class ".application.ApplicationDetails" on path: DexPathList[[zip file "/data/app/com.test.apk"],nativeLibraryDirectories=[/data/app-lib/com.uncommonsense-1, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
at android.app.ActivityThread.access$1500(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1270)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5028)
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:788)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:604)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.ucsvirtualschool.application.ApplicationDetails" on path: DexPathList[[zip file "/data/app/com.uncommonsense-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.uncommonsense-1, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newApplication(Instrumentation.java:975)
应用程序类
public class ApplicationDetails extends MultiDexApplication {
public static boolean isAppOpen = false;
private static ApplicationDetails mInstance;
public static final String TAG = ApplicationDetails.class.getSimpleName();
@Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
super.attachBaseContext(base);
}
@Override
public void onTerminate() {
// TODO Auto-generated method stub
super.onTerminate();
isAppOpen = false;
}
}
构建gradle
defaultConfig {
applicationId "com.ucsvirtualschool"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables { useSupportLibrary = true }
dataBinding {
enabled = true
}
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
ndk {
abiFilters "armeabi", "x86"
}
implementation 'com.android.support:multidex:1.0.3' //for solve issue in mi tab
答案 0 :(得分:0)
根据您提供的代码段,我会想到两件事。
答案 1 :(得分:0)
也许您可以尝试以下操作:在.application.ApplicationDetails
中的“ com.ucsvirtualschool.application.ApplicationDetails
”中填写应用程序名称“ AndroidManifest.xml
”。
<application
android:name="com.ucsvirtualschool.application.ApplicationDetails"
android:allowBackup="false"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:allowBackup">