我在设备中测试我的应用程序它显示调试logcat中的错误这是什么错误以及如何解决这个问题?
错误是
There was a problem getting an ad response. ErrorCode: 1
Run Code Online (Sandbox Code Playgroud)
我的xml代码是
<RelativeLayout 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:background="@color/accent_material_light"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
>
<com.google.android.gms.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
Run Code Online (Sandbox Code Playgroud)
我显示广告的代码是
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
Run Code Online (Sandbox Code Playgroud)
在清单文件中我正在添加.代码工作正常,但广告没有显示我正在我的设备上测试它
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!--This meta-data tag is required to use Google Play Services.-->
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
Run Code Online (Sandbox Code Playgroud) 您好,我正在录音,这给我带来了一个错误。
我不明白有人可以帮助我吗?
2021-01-24 19:21:53.708 4661-4661/com.koteswara.mediarecordersample E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2021-01-24 19:21:53.716 4661-4703/com.koteswara.mediarecordersample E/Perf: Fail to get file list com.koteswara.mediarecordersample
2021-01-24 19:21:53.716 4661-4703/com.koteswara.mediarecordersample E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
2021-01-24 19:21:53.716 4661-4703/com.koteswara.mediarecordersample E/Perf: Fail to get file list com.koteswara.mediarecordersample
2021-01-24 19:21:53.716 4661-4703/com.koteswara.mediarecordersample E/Perf: getFolderSize() : Exception_1 = java.lang.NullPointerException: Attempt to get length of null array
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,用户选择 1、21、51、101、108 之类的计数,就像他使用按钮或单选按钮选择时一样,媒体播放器必须重复多次。如果他选择 21,媒体播放器应该重复播放音乐 21 次。在我的代码中,如果我在 for 循环中使用 while 循环,它会阻塞 UI,不允许停止或暂停播放,如果我没有使用 while 循环,它只会播放一次。请我需要解决它,任何人都会提前感谢。下面我发布了我的整个代码
public class MainActivity extends Activity implements OnClickListener{
private MediaPlayer mp;
int count;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
findViewById(R.id.button_1).setOnClickListener(this);
findViewById(R.id.button_2).setOnClickListener(this);
findViewById(R.id.button_3).setOnClickListener(this);
findViewById(R.id.button_4).setOnClickListener(this);
findViewById(R.id.button_5).setOnClickListener(this);
findViewById(R.id.pause).setOnClickListener(this);
findViewById(R.id.stop).setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_1:
if (mp!=null) {
mp.release();
}
player(3);
break;
case R.id.button_2:
if (mp!=null) {
mp.release();
}
player(21);
break;
case R.id.button_3:
if (mp!=null) {
mp.release();
}
player(51);
break;
case R.id.button_4:
if …
Run Code Online (Sandbox Code Playgroud)