gpt4 book ai didi

android - admob 连接被拒绝

转载 作者:太空宇宙 更新时间:2023-11-03 11:22:23 25 4
gpt4 key购买 nike

我刚刚开始将 admob 添加到我的 android 应用程序,并开始使用 admob 网站上提供的横幅基本要素示例。这是示例代码。

public class BannerEssentials extends Activity{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

// Lookup R.layout.main
LinearLayout layout = (LinearLayout)findViewById(R.id.linearLayout);

// Create the adView
// Please replace MY_BANNER_UNIT_ID with your AdMob Publisher ID
AdView adView = new AdView(this, AdSize.BANNER, "a14da528179106a");

// Add the adView to it
layout.addView(adView);

// Initiate a generic request to load it with an ad
AdRequest request = new AdRequest();
request.setTesting(true);

adView.loadAd(request);
}
}

我已经使用 admob 设置了我的帐户,一切似乎都已就绪,当我查看我的 logCat 时,我看到以下 admob 连接被拒绝的错误消息。有没有其他人遇到过这个问题,如果遇到过,您是如何解决的?预先感谢您的帮助。

04-13 11:39:33.410: WARN/Ads(5662): java.net.ConnectException: r.admob.com/127.0.0.1:80 - Connection refused
04-13 11:39:33.410: WARN/Ads(5662): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:254)
04-13 11:39:33.410: WARN/Ads(5662): at org.apache.harmony.luni.net.PlainSocketImpl.connect(PlainSocketImpl.java:533)
04-13 11:39:33.410: WARN/Ads(5662): at java.net.Socket.connect(Socket.java:1055)
04-13 11:39:33.410: WARN/Ads(5662): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
04-13 11:39:33.410: WARN/Ads(5662): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
04-13 11:39:33.410: WARN/Ads(5662): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
04-13 11:39:33.410: WARN/Ads(5662): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
04-13 11:39:33.410: WARN/Ads(5662): at b.a(Unknown Source)
04-13 11:39:33.410: WARN/Ads(5662): at b.doInBackground(Unknown Source)
04-13 11:39:33.410: WARN/Ads(5662): at android.os.AsyncTask$2.call(AsyncTask.java:185)
04-13 11:39:33.410: WARN/Ads(5662): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
04-13 11:39:33.410: WARN/Ads(5662): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
04-13 11:39:33.410: WARN/Ads(5662): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
04-13 11:39:33.410: WARN/Ads(5662): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
04-13 11:39:33.410: WARN/Ads(5662): at java.lang.Thread.run(Thread.java:1096)

下面是我的 list 文件。

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.ads.example"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".BannerEssentials"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-sdk android:minSdkVersion="3" />

</manifest>

最佳答案

您的 list 是如何设置的?是否添加了上网权限?您是否设置了适当的元数据参数?

关于android - admob 连接被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5654172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com