【问题标题】:Unable to instantiate appComponentFactory when using Google Maps Android Marker Clustering Utility使用 Google Maps Android Marker Clustering Utility 时无法实例化 appComponentFactory
【发布时间】:2019-05-09 17:15:11
【问题描述】:

当我尝试运行我的应用并从 Google 加载地图以显示附近的地点时,它会显示地图而不是地点。我一直在 Stackoverflow 上搜索,但没有找到可行的解决方案...

这是我的错误的一部分:

2018-12-07 23:59:28.409 1872-1872/? E/LoadedApk: Unable to instantiate appComponentFactory
    java.lang.ClassNotFoundException: Didn't find class "android.support.v4.app.CoreComponentFactory" on path: DexPathList[[],nativeLibraryDirectories=[/system/priv-app/GoogleSdkSetup/lib/x86, /system/lib, /system/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.LoadedApk.createAppFactory(LoadedApk.java:226)
        at android.app.LoadedApk.updateApplicationInfo(LoadedApk.java:338)
        at android.app.ActivityThread.handleDispatchPackageBroadcast(ActivityThread.java:5388)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1733)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at com.android.server.SystemServer.run(SystemServer.java:454)
        at com.android.server.SystemServer.main(SystemServer.java:294)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:838)
2018-12-07 23:59:30.224 1714-1849/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2018-12-07 23:59:30.309 1714-1849/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2018-12-07 23:59:30.496 6272-6388/? E/PlaceInferenceEngine: Position timestamp out of order. Previous: 1544223082635, Current: 1544219970000. Skipping this Position.
2018-12-07 23:59:40.591 1872-1885/? E/memtrack: Couldn't load memtrack module
2018-12-07 23:59:50.218 1822-1822/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2018-12-07 23:59:50.218 1822-1822/? E/netmgr: WifiForwarder unable to open QEMU pipe: Invalid argument
2018-12-07 23:59:50.643 1872-1885/? E/memtrack: Couldn't load memtrack module
2018-12-07 23:59:58.282 1727-1812/? E/storaged: getDiskStats failed with result NOT_SUPPORTED and size 0
2018-12-08 00:00:00.716 9163-9163/? E/ndroid.calenda: Not starting debugger since process cannot load the jdwp agent.
2018-12-08 00:00:00.916 9180-9180/? E/viders.calenda: Not starting debugger since process cannot load the jdwp agent.
2018-12-08 00:00:00.949 9163-9163/? E/PrefServiceImpl: Primary account is null
2018-12-08 00:00:21.270 1872-1885/? E/memtrack: Couldn't load memtrack module

我的清单如下所示:

<?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.example.rhaniegghe.googlemaps">

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>



    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:usesCleartextTraffic="true"
        >

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

        <activity android:name=".MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <uses-library android:name="org.apache.http.legacy" android:required="false" />


    </application>


</manifest>

还有我的 Gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.rhaniegghe.googlemaps"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }
}

dependencies {

    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    implementation 'com.google.android.gms:play-services-location:16.0.0'
    implementation 'com.google.android.gms:play-services-places:16.0.0'
    implementation 'com.google.maps.android:android-maps-utils:0.5+'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

如果有人能指出我正确的方向。我尝试了以下解决方案,但没有运气。

link

提前致谢!

【问题讨论】:

    标签: java android google-maps google-maps-api-3 android-appcompat


    【解决方案1】:

    我的解决方案是使用 使缓存无效并重新启动

    在 Android Studio 的 Menu 选项中单击 File 并搜索选项 Invalidate cache and restart

    【讨论】:

    • 我不知道为什么,但这为我解决了它...谢谢!
    猜你喜欢
    • 1970-01-01
    • 2015-04-30
    • 2014-05-15
    • 2016-12-29
    • 2016-09-17
    • 1970-01-01
    • 1970-01-01
    • 2013-12-31
    • 2015-07-31
    相关资源
    最近更新 更多