[英]java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable (PROJECT ADDED!!)
this is kinda a newbie question, but I'm having this problem even following the Google guides. 这是一个新手问题,但是即使按照Google指南,我也遇到了这个问题。
My app is crashing when seeing a map, with this throw: 看到地图时,我的应用程序崩溃了,并抛出以下错误:
java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable
it had happened only with Samsung Galaxy S III , I'm trying to some other like Samsung Galaxy ACE, Samsung WIFI 5.0 and some others and that doesn't happen . 它只发生在Samsung Galaxy S III上 ,我正在尝试其他一些功能,例如Samsung Galaxy ACE,Samsung WIFI 5.0和其他一些功能,但那没有发生 。
1.- I have added my project library. 1.-我已经添加了我的项目库。
2.- I have the jar on my build path: 2.-我的构建路径上有jar:
3.- I have followed the Getting Started on Google Maps V2 for Android: 3.-我遵循了Android版Google Maps V2入门:
part of AndroidManifest.xml AndroidManifest.xml的一部分
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<!-- Only this application can receive the messages and registration result -->
<permission android:name="my.package.example.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="my.package.example.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- Send the registration id to the server -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBCYlMBZVuvPtCQm9mznppJTCnBbH8QRFI"/>
<activity ...
My activity code (mappa.class) where it crashes 我的活动代码(mappa.class)崩溃了
@Override
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (layout != null) {
ViewGroup parent = (ViewGroup) layout.getParent();
if (parent != null)
parent.removeView(layout);
}
try {
// HERE IT'S WHEN IT CRASHES!! THE FOLLOWING LINE
layout = inflater.inflate(R.layout.fragmentmappa, container, false);
} catch (Exception e) {
e.printStackTrace();
}
And my layout fragmentmappa.xml 和我的布局fragmentmappa.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
Thanks in advance. 提前致谢。
It seems everything is fine in your code, Do following: 在您的代码中似乎一切正常,请执行以下操作:
clean and build and 清洁和建造
then first uninstall and then install the app. 然后先卸载然后再安装该应用程序。
And see if it works. 看看是否可行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.