我正在尝试将Inmobi sdk集成到我的Android项目中。我使用以下代码添加了一个横幅:
<com.inmobi.monetization.IMBanner android:layout_width="320dp"
android:layout_height="50dp" android:id="@+id/banner"
adSize="15" appId="myAppId" />
我已将初始化代码添加到activity的onCreate函数中,如下所示:
InMobi.initialize(this, "myAppId");
InMobi.setLogLevel(InMobi.LOG_LEVEL.DEBUG.DEBUG);
我正在使用inmobi dashbaord中的property-id而不是“myAppId”。我使用logcat中的“Publisher device Id”将我的手机添加到测试设备列表中,该命令由Inmobi SDK调试语句写入输出。当我在我的设备上启动应用程序时,我得到以下内容:
08-06 19:15:17.211: DEBUG/[InMobi]-4.4.3(20608): Publisher device Id is .........
08-06 19:15:17.211: DEBUG/[InMobi]-[Network]-4.4.3(20608): >>>> Start loading new Ad <<<<
08-06 19:15:17.211: DEBUG/[InMobi]-[Network]-4.4.3(20608): Current Ad State: loading
08-06 19:15:17.371: DEBUG/[InMobi]-[RE]-4.4.3(20608): Injecting JavaScript: window.mraid.broadcastEvent('sizeChange',320,50);
08-06 19:15:17.381: DEBUG/[InMobi]-[Network]-4.4.3(20608): Exception retreiving Ad due to key problem
08-06 19:15:17.381: DEBUG/[InMobi]-[Network]-4.4.3(20608): >>> Got HTTP REQUEST callback. Status: 1
08-06 19:15:17.391: DEBUG/[InMobi]-[Network]-4.4.3(20608): INTERNAL_ERROR
08-06 19:15:19.313: DEBUG/[InMobi]-[Analytics]-4.4.3(20608): NetworkManager->handleMessag: msg:{ when=-31ms what=1001 target=android.os.Handler targetCallback=com.inmobi.commons.analytics.net.AnalyticsNetworkManager$a$a@42132c38 }
08-06 19:15:19.333: DEBUG/[InMobi]-[Analytics]-4.4.3(20608): IMAppDatabaseManager->getEvents
08-06 19:15:19.353: DEBUG/[InMobi]-[Analytics]-4.4.3(20608): PayloadBuilder->getPayloadList:
08-06 19:16:17.395: DEBUG/[InMobi]-4.4.3(20608): Publisher device Id is ......
08-06 19:16:17.395: DEBUG/[InMobi]-[Network]-4.4.3(20608): >>>> Start loading new Ad <<<<
08-06 19:16:17.405: DEBUG/[InMobi]-[Network]-4.4.3(20608): Current Ad State: loading
08-06 19:16:17.475: DEBUG/[InMobi]-[Network]-4.4.3(20608): sm=...............
08-06 19:16:17.536: DEBUG/[InMobi]-[Network]-4.4.3(20608): Exception retrieving ad
08-06 19:16:17.536: DEBUG/[InMobi]-[Network]-4.4.3(20608): >>> Got HTTP REQUEST callback. Status: 1
08-06 19:16:17.536: DEBUG/[InMobi]-[Network]-4.4.3(20608): NETWORK_ERROR
答案 0 :(得分:1)
第一个错误是INTERNAL_ERROR。当sdk在为你准备广告之前仍在升温时,它会被抛出。它仅在您安装应用程序实例时才第一次发生。 第二个错误是NETWORK_ERROR。当您的设备未连接到网络或设备上存在网络连接问题时,就会出现这种情况。请检查一次,并确保您已在应用中添加INTERNET和ACCESS_NETWORK_STATE的强制权限