Appolica / InteractiveInfoWindowAndroid

Library project, developed and maintained by Appolica, offering an interactive info window for Google maps on Android.
249 stars 56 forks source link

FragmentManager cannot find MapInfoWindowFragment #49

Closed sryze closed 4 years ago

sryze commented 4 years ago

I'm trying to use this library but keep getting this exception:

...
Caused by: kotlin.TypeCastException: null cannot be cast to non-null type com.appolica.interactiveinfowindow.fragment.MapInfoWindowFragment

Here is how I create the fragment:

supportFragmentManager.findFragmentById(R.id.info_window) as MapInfoWindowFragment

info_window.xml:

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/info_window"
    android:name="com.appolica.interactiveinfowindow.fragment.MapInfoWindowFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MapActivity" />

build.gradle:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.squareup.retrofit2:retrofit:2.6.4'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
    implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.5.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    implementation 'com.google.maps.android:android-maps-utils:1.0.2'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'com.appolica:interactive-info-window:1.0.8'
}

Any idea why the fragment manager can't find MapInfoWindowFragment?