java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable

时间:2017-07-12 10:48:01

标签: android google-maps google-play-services

XML中的

<fragment android:id="@+id/map" 
   android:name="in.mpo.mpmobile.KioskListLocation" 
   android:layout_width="match_parent" 
   android:layout_height="wrap_content" 
   class="com.google.android.gms.maps.SupportMapFragment" />

我正在尝试加载Google地图但不幸的是它显示错误

  

java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable at   com.google.android.gms.maps.GoogleMapOptions.createFromAttri butes(未知   来源)com.google.android.gms.maps.MapFragment.onInflate(未知   源)

构建文件中的

dependencies 
{ 
  compile fileTree(include: ['*.jar'], dir: 'libs') 
  compile files('libs/android-support-v4.jar') 
  compile files('libs/google-play-services.jar') 
} 

2 个答案:

答案 0 :(得分:0)

更改xml中的类

<fragment android:id="@+id/map" 
   android:layout_width="match_parent" 
   android:layout_height="match_parent" 
   class="com.google.android.gms.maps.MapFragment" />

答案 1 :(得分:0)

请你试试这个吗?

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
</fragment>
相关问题