首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >加载com.google.android.gms.r styleable失败

加载com.google.android.gms.r styleable失败
EN

Stack Overflow用户
提问于 2016-08-27 06:17:13
回答 1查看 467关注 0票数 0

我想将admob集成到我的应用程序中。我正尝试在https://firebase.google.com/docs/admob/android/quick-start上运行测试代码。

我目前的google-play-service版本是32。在此之前,我正在开发版本29。由于谷歌已将play_service库拆分为多个库,因此我过去常常从m2repository的每个库商店中选择并提取。目前我选择了play-services-ads-lite-9.0.0 .jar。这是我在项目中包含的唯一jar文件。当我运行代码时,应用程序崩溃。编译器中没有警告或错误。

我的清单文件:

代码语言:javascript
复制
<?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>

我的布局XML

代码语言:javascript
复制
<?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>

我的Java代码:

代码语言:javascript
复制
@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();
}

我无法理解并解决此错误: java.lang.ClassNotFoundException:未在路径中找到类"com.google.android.gms.R$styleable“:DexPathList[zip file "/data/app/com.richa.India_Sales-1/base.apk",nativeLibraryDirectories=/com.google.android.gms.R$styleable/lib,/system/lib]

请帮帮忙。谢谢

EN

回答 1

Stack Overflow用户

发布于 2016-08-27 06:40:46

您正在使用错误的应用程序id,您必须获取新的个人id

要查找您的应用程序ID,请单击AdMob帐户页面上设置下拉列表(位于右上角)下的应用程序管理选项。应用程序ID的格式为ca-app-pub-XXXXXXXXXXXXXXXX~NNNNNNNNNN.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39175351

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档