简体   繁体   English

无法加载“可设置样式的com.google.android.gms.r”

[英]Failed to load “com.google.android.gms.r styleable”

I want to integrate admob in my application. 我想将admob集成到我的应用程序中。 I am trying to run the testing code at https://firebase.google.com/docs/admob/android/quick-start . 我正在尝试在https://firebase.google.com/docs/admob/android/quick-start上运行测试代码。

My current google-play-service version is 32. Previously I was working on version 29. Since google has splited the play_service library into multiple libraries, i used to select and extract from each library store at m2repository. 我当前的google-play-service版本是32。以前我正在使用版本29。由于google将play_service库拆分为多个库,因此我曾经从m2repository的每个库中选择和提取。 Currently I have selected play-services-ads-lite-9.0.0 .jar. 目前,我选择了play-services-ads-lite-9.0.0 .jar。 This is the only jar file I have included in my project. 这是我项目中包含的唯一jar文件。 When I run the code, app crashes. 当我运行代码时,应用崩溃。 No warnings or errors in compiler. 编译器中无警告或错误。

My manifest file: 我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.richa.salemob"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"
          android:targetSdkVersion="23"/>

        <uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application android:icon="@drawable/icon"
             android:label="@string/app_name"
             android:allowBackup="true"
             android:theme="@android:style/Theme.Black.NoTitleBar">
    <activity android:name=".Start">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

    <activity android:name="com.google.android.gms.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode"/>

    <meta-data android:name="com.google.android.gms.version"
               android:value="@integer/google_play_services_version" />

</application></manifest>

My Layout XML 我的布局XML

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:ads="http://schemas.android.com/apk/lib/com.richa.salesmob"
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@color/white">
<com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>

My Java Code: 我的Java代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.start);
MobileAds.initialize(StartFields.context, "ca-app-pub-3940256099942544~3347511713");
AdView adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new
AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build();
adView.loadAd(adRequest);
init();
}

I am unable to understand and resolve the error: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.R$styleable" on path: DexPathList[[zip file "/data/app/com.richa.India_Sales-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 我无法理解并解决错误:java.lang.ClassNotFoundException:在路径:DexPathList [[zip file“ /data/app/com.com]中找不到类” com.google.android.gms.R $ styleable“。 richa.India_Sales-1 / base.apk“],nativeLibraryDirectories = [/ vendor / lib,/ system / lib]]

Please help. 请帮忙。 Thank you 谢谢

You are using a wrong app id, you have to get a new individual id 您使用了错误的应用程序ID,您必须获得一个新的个人ID

To find your app ID, click the App management option under the settings dropdown (located in the upper right-hand corner) on the AdMob account page. 要找到您的应用ID,请点击AdMob帐户页面上设置下拉菜单(位于右上角)下的应用管理选项。 App IDs have the form ca-app-pub-XXXXXXXXXXXXXXXX~NNNNNNNNNN. 应用程序ID的格式为ca-app-pub-XXXXXXXXXXXXXXXX〜NNNNNNNNNN。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误Android com.google.android.gms.r $ styleable错误 - Error Android com.google.android.gms.r$styleable error NoClassDefFoundError:com.google.android.gms.R $ styleable - NoClassDefFoundError: com.google.android.gms.R$styleable Android Google Maps v2:java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable - Android Google Maps v2: java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable Maps Android V2:java.lang.noclassdeffounderror:com.google.android.gms.R $ styleable - Maps Android V2: java.lang.noclassdeffounderror: com.google.android.gms.R$styleable E / AndroidRuntime(622):java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable - E/AndroidRuntime(622): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable android:java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable - android : java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable java.lang.NoClassDefFoundError:com.google.android.gms.R $在Android中可设置样式 - java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable in android 运行时错误:java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable - Run Time Error : java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable 追踪套件名称后找不到com.google.android.gms.R $ styleable - com.google.android.gms.R$styleable not found after chaging name of package java.lang.NoClassDefFoundError:com.google.android.gms.R $ styleable(已添加项目!) - java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable (PROJECT ADDED!!)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM