Android   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了java.lang.NoClassDefFoundError:com.google.android.gms.R $styleable(已添加项目!)大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

这是一个新手问题,但是即使按照Google指南,我也遇到了这个问题.

看到地图时,我的应用程序崩溃了,并抛出以下错误

它只发生在Samsung Galaxy S III上,我正在尝试其他一些功能,例如Samsung Galaxy ACE,Samsung WIFI 5.0等,但这并没有发生.

1.-我已经添加了我的项目库.

2.-我的构建路径上有jar:

3.-我遵循了Android版Google Maps V2入门:

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 ...

我的活动代码(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();
     }

和我的布局fragmentmappa.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://scheR_818_11845@as.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>

提前致谢.

解决方法:

在您的代码中似乎一切正常,请执行以下操作:

>清洁并建造
>然后先卸载,然后安装该应用程序.

看看是否可行.

大佬总结

以上是大佬教程为你收集整理的java.lang.NoClassDefFoundError:com.google.android.gms.R $styleable(已添加项目!)全部内容,希望文章能够帮你解决java.lang.NoClassDefFoundError:com.google.android.gms.R $styleable(已添加项目!)所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: