私のアプリケーションにadmobを統合したいと思います。私はhttps://firebase.google.com/docs/admob/android/quick-startでテストコードを実行しようとしています。"com.google.android.gms.r styleable"を読み込めませんでした
私の現在のgoogle-play-serviceバージョンは32です。以前はバージョン29で作業していました.Googleはplay_serviceライブラリを複数のライブラリに分割していましたので、私はm2repositoryの各ライブラリストアから選択し抽出しました。現在私はplay-services-ads-lite-9.0.0 .jarを選択しています。これは私のプロジェクトに含まれている唯一のjarファイルです。コードを実行すると、アプリがクラッシュします。コンパイラに警告やエラーはありません。
私のマニフェストファイル:
<?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
<?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コード:私は理解し、エラーを解決することができません
@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"というクラスが見つかりませんでした:DexPathLi st [[zipファイル "/data/app/com.richa.India_Sales-1/base.apk"],nativeLibraryDirectories=[vendor/lib、/ system/lib]]
助けてください。あなたは間違ったアプリケーションIDを使用している
iはGradleのファイルを持っていないのGradleファイル – Juvie22
を貼り取得する必要があります、ありがとうございました。私はこのコードをApiレベル9で作成しています。これは、AdMobがIntellijを通常のAndroidアプリケーションとして使用するために最低限必要なものです。 –
11時間まだ回答がありません:(誰かが見てください –