首先,我是Admob的新手。我按照了YouTube视频,一步一步地做了一切。但最后我收到错误代码1。我搜索了一些其他问题。作为答案我重新创建了广告单元,但仍然没有解决方案。
所以请帮助我..
XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:background="#FFFFFF">
<View
android:layout_width="match_parent"
android:layout_height="12dp"
android:background="@drawable/shadow" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="center"
android:gravity="center"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DroidCPU"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/main_color"
android:textStyle="bold"
android:shadowColor="#33000000"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="1.5"/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="200px"
android:layout_height="200px"
android:src="@drawable/icon_top_colored" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="for Android"
android:textColor="@color/main_color" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Version 1.1"
android:textColor="@color/main_color"
android:textStyle="bold" />
<Button
android:id="@+id/bt_read"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:background="@drawable/button_style3"
android:text="Rate DroidCPU"
android:textColor="@color/main_color" />
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="@+id/ad_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id" />
</LinearLayout>
的java
package com.buckydroid.app.droidcpu;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.buckydroid.app.droidcpu.R;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
/**
* A fragment that launches other parts of the demo application.
*/
public class PageAbout extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_about, container, false);
AdView mAdView = (AdView) rootView.findViewById(R.id.ad_view);
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice("A06424DCD5F3F8D4D9426EC88FACDC56").
build();
mAdView.loadAd(adRequest);
// Demonstration of a collection-browsing activity.
rootView.findViewById(R.id.bt_read).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Uri uri = Uri.parse("market://details?id=" + getActivity().getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
getActivity().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://buckydroid.com" + getActivity().getPackageName())));
}
}
});
return rootView;
}
}
logcat的
06-20 01:11:46.711 15198-15198/com.buckydroid.app.droidcpu I/Ads: Starting ad request.
06-20 01:11:46.743 15198-15198/com.buckydroid.app.droidcpu W/AudioCapabilities: Unsupported mime audio/evrc
06-20 01:11:46.746 15198-15198/com.buckydroid.app.droidcpu W/AudioCapabilities: Unsupported mime audio/qcelp
06-20 01:11:46.749 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
06-20 01:11:46.769 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
06-20 01:11:46.773 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unrecognized profile/level 0/3 for video/mpeg2
06-20 01:11:46.784 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/x-ms-wmv
06-20 01:11:46.788 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/x-ms-wmv
06-20 01:11:46.793 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/wvc1
06-20 01:11:46.797 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/wvc1
06-20 01:11:46.801 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/divx
06-20 01:11:46.805 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/divx311
06-20 01:11:46.809 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/divx4
06-20 01:11:46.825 15198-15198/com.buckydroid.app.droidcpu W/VideoCapabilities: Unsupported mime video/mp4v-esdp
06-20 01:11:46.860 15198-15198/com.buckydroid.app.droidcpu I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
06-20 01:11:46.873 15198-15337/com.buckydroid.app.droidcpu I/OMXClient: Using client-side OMX mux.
06-20 01:11:47.288 15198-15198/com.buckydroid.app.droidcpu W/FragmentManager: moveToState: Fragment state for PageAllFragment{e034415 #0 id=0x7f0d008d android:switcher:2131558541:1} not updated inline; expected state 3 found 2
06-20 01:11:47.669 15198-15209/com.buckydroid.app.droidcpu W/Ads: There was a problem getting an ad response. ErrorCode: 1
06-20 01:11:48.337 15198-15198/com.buckydroid.app.droidcpu I/Choreographer: Skipped 43 frames! The application may be doing too much work on its main thread.
06-20 01:11:48.356 15198-15198/com.buckydroid.app.droidcpu W/Ads: Failed to load ad: 1
所以请帮助我。