我正在使用Android Studio 3.3 canary 13
。该应用程序崩溃并显示此消息。
我遇到此错误:
Caused by: android.view.InflateException: Binary XML file line #274: Binary XML file line #274: Error inflating class com.google.android.gms.maps.MapView
Caused by: android.view.InflateException: Binary XML file line #274: Error inflating class com.google.android.gms.maps.MapView
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapView" on path: DexPathList[[zip file .
有人可以在MapView
中使用AndroiX
吗?
问题XML行:
<com.google.android.gms.maps.MapView
android:id="@+id/map_view"
android:layout_width="0dp"
android:layout_height="140dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_address"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintVertical_bias="0"
android:layout_marginTop="16dp"
/>
答案 0 :(得分:0)
可能是这项工作,只需在您的AndroidManifast.xml
中定义
首先添加:-
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyC6TVk6gtR_i_.......**************"/>
然后:-
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@integer/your_google_maps_version" />