Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

java - 无法实例化appComponentFactory java.lang.ClassNotFoundException(Unable to instantiate appComponentFactory java.lang.ClassNotFoundException)

App crashes in the emulator while it works fine on my phone.

(应用程序在模拟器中崩溃,但可以在我的手机上正常运行。)

As far I remember, I didn't make any change and its suddenly started occurring.

(据我所知,我没有做任何更改,并且突然开始发生。)

I have tried to find the solution but no luck.

(我试图找到解决方案,但是没有运气。)

I would appreciate if you could help me on this

(如果您能在此方面帮助我,我将不胜感激)

AndroidManifest.xml (AndroidManifest.xml)

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.stampedesolution.fv">



<uses-feature
    android:name="android.hardware.camera"
    android:required="true" />

<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:required="true" />
<uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    android:required="true" />
<uses-permission
    android:name="android.permission.RECEIVE_BOOT_COMPLETED"
    android:required="true" />
<uses-permission
    android:name="android.permission.READ_PHONE_STATE"
    android:required="true" />
<uses-permission
    android:name="android.permission.ACCESS_COARSE_LOCATION"
    android:required="true" />
<uses-permission
    android:name="android.permission.RECORD_AUDIO"
    android:required="true" />
<uses-permission
    android:name="android.permission.ACCESS_FINE_LOCATION"
    android:required="true" />
<uses-permission
    android:name="android.permission.INTERNET"
    android:required="true" />
<uses-permission
    android:name="android.permission.ACCESS_NETWORK_STATE"
    android:required="true" />
<uses-permission
    android:name="android.permission.CAMERA"
    android:required="true" />

<application
    android:allowBackup="true"
    android:hardwareAccelerated="false"
    android:icon="@drawable/roadie"
    android:label="@string/app_name"
    android:roundIcon="@drawable/roadie"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    android:usesCleartextTraffic="true">
    <activity
        android:name=".QrCodeScannerActivity2"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".QrCodeScannerActivity1"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".ProfileActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".AbortMissionActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".AddNewRecording"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".AddNewPhotoActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".AddNewRemarkActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".AddNewPhoneNumberActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".AddNewAddressActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".ShowInfoActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".MenuActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <!--
         The API key for Google Maps-based APIs is defined as a string resource.
         (See the file "res/values/google_maps_api.xml").
         Note that the API key is linked to the encryption key used to sign the APK.
         You need a different API key for each encryption key, including the release key that is used to
         sign the APK for publishing.
         You can define the keys for the debug and release targets in src/debug/ and src/release/.
    -->
    <activity
        android:name=".MapsActivity"
        android:label="Maps" />
    <activity
        android:name=".MainActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".LoginActivity"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity
        android:name=".SplashScreen"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />
    <meta-data
        android:name="preloaded_fonts"
        android:resource="@array/preloaded_fonts" />

    <provider
        android:name="androidx.core.content.FileProvider"
        android:authorities="com.stampedesolution.fv.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths" />
    </provider>
    <service android:name=".Firebase.FirebaseMessagingReciever">
        <intent-filter>
            <action android:name="com.google.firebase.MESSAGING_EVENT"/>
        </intent-filter>
    </service>
</application>

build.gradle (build.gradle)

apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
    applicationId "com.stampedesolution.fv"
    minSdkVersion 24
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    useLibrary 'org.apache.http.legacy'
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
compileOptions {

    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8

}
packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
}
sourceSets {
    main {
        res.srcDirs =
                [
                        'src/main/res/layout',
                        'src/main/res'
                ]
    }
}
}
 apply plugin: 'com.google.gms.google-services'
 dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'androidx.navigation:navigation-fragment:2.1.0'
implementation 'androidx.navigation:navigation-ui:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.evrencoskun.library:tableview:0.8.8'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.kaopiz:kprogresshud:1.0.2'
implementation "com.google.android.gms:play-services-location:17.0.0"
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation('org.apache.httpcomponents:httpmime:4.3.6') {
    exclude module: 'httpclient'
}
implementation 'org.apache.httpcomponents:httpclient-android:4.3.5'
implementation 'me.dm7.barcodescanner:zxing:1.9.13'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'io.realm:android-adapters:2.0.0'
implementation  "io.realm:realm-gradle-plugin:6.0.1"
implementation 'me.dm7.barcodescanner:zbar:1.9.13'

implementation 'com.google.firebase:firebase-messaging:20.0.1'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.gms:google-services:4.3.3'

implementation 'com.github.clans:fab:1.6.4'
implementation 'com.github.mkhoiron:Actionsheet-android:0.1'
implementation 'androidx.mediarouter:mediarouter:1.1.0'
implementation 'com.evrencoskun.library:tableview:0.8.8'

implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'



implementation 'com.loopj.android:android-async-http:1.4.9'

}

(})

Error (错误)

Unable to instantiate appComponentFactory
java.lang.ClassNotFoundException: Didn't find class "androidx.core.app.CoreComponentFactory" on path: DexPathList[[zip file "/data/app/com.stampedesolution.fv-wiGk1bQhfb01ooy7YPDN1w==/base.apk"],nativeLibraryDirectories=[/data/app/com.stampedesolution.fv-wiGk1bQhfb01ooy7YPDN1w==/lib/x86, /data/app/com.stampedesolution.fv-wiGk1bQhfb01ooy7YPDN1w==/base.apk!/lib/x86, /system/lib, /system/product/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.LoadedApk.createAppFactory(LoadedApk.java:256)
    at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:855)
    at android.app.LoadedApk.getClassLoader(LoadedApk.java:950)
    at android.app.LoadedApk.getResources(LoadedApk.java:1188)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2462)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2454)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6343)
    at android.app.ActivityThread.access$1300(ActivityThread.java:219)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1859)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
    Suppressed: java.io.IOException: Failed to open dex files from /data/app/com.stampedesolution.fv-wiGk1bQhfb01ooy7YPDN1w==/base.apk because: Bad encoded_array value: Failure to verify dex file '/data/app/com.stampedesolution.fv-wiGk1bQhfb01ooy7YPDN1w==/base.apk': Bad encoded_value method type size 7
    at dalvik.system.DexFile.openDexFileNative(Native Method)
    at dalvik.system.DexFile.openDexFile(DexFile.java:365)
    at dalvik.system.DexFile.<init>(DexFile.java:107)
    at dalvik.system.DexFile.<init>(DexFile.java:80)
    at dalvik.system.DexPathList.loadDexFile(DexPathList.java:444)
    at dalvik.system.DexPathList.makeDexElements(DexPathList.java:403)
    at dalvik.system.DexPathList.<init>(DexPathList.java:164)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:126)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:101)
    at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:74)
    at com.android.internal.os.ClassLoaderFactory.createClassLoader(ClassLoaderFactory.java:87)
    at com.android.internal.os.ClassLoaderFactory.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...