1. [Accessibility] Missing contentDescription attribute on image
ADT提示,需要为该控件添加一个内容描述,描述该控件的作用。
解决方案:添加android:contentDescription="@string/des_iv"
2. <uses-sdk> tag should specify a target API level (the highest verified version; when running on later versions, compatibility behaviors may be enabled) with android:targetSdkVersion="?"
解决方案:<uses-sdk>添加android:targetSdkVersion="30"
3. This tag and its children can be replaced by one <TextView/> and a compound drawable
TextView带有drawableRight属性,可以指定在TextView的上下左右方位的图像资源。
解决方案:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/check_tv_sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/info" />
<ImageView
android:src="@drawable/male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/des_iv" />
</LinearLayout>
更改为
<TextView
android:id="@+id/check_tv_sex"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableRight="@drawable/male"
android:text="@string/info" />
4. 在执行StartActivity时报Source Not Found的异常:
解决方案:只是因为在AndroidManifest.xml中未声明你要跳转到的那个Activity。
在主Activity同级添加一个Activity节点:
<activity
android:name="com.simple.NewSimpleActivity"
android:label="@string/app_name" >
</activity>
5. Mediaplayer播放时报Should have subtitle controller already set的异常:
解决方案:将prepare改为prepareAsync,然后start方法在Prepared事件里面调用。
this.mediaPlayer.prepareAsync();
this.mediaPlayer.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});
6.SDK更新时的“https://dl-ssl.google.com refused”
解决方案:将https://修改为http://。 在Android SDK Manager->Tools-Options...选项界面,将“Force https://… sources to be fetched using http://…”勾选。
如果还不行,则在文件(C:\Windows\System32\drivers\etc\hosts)中,添加如下几行:
203.208.46.146 www.google.com
203.208.46.146 dl.google.com
203.208.46.146 dl-ssl.google.com