android SDK23 一些api无法使用的解决方案

1.Call requires API level 16 (current min is 11): android.app.Notification.Builder#build

Notification noti = new Notification.Builder(mContext)
         .setContentTitle("New mail from " + sender.toString())
         .setContentText(subject) 
         .setSmallIcon(R.drawable.new_mail)
         .setLargeIcon(aBitmap) 
         .build(); 

How exactly to use Notification.Builder
Call requires API level 16 (current min is 14): android.app.Notification.Builder#build
setLatestEventInfo cannot be resolved

2.api 23 FloatMath Method FloatMath.sqrt() not found

(float)Math.sqrt(...)

http://stackoverflow.com/questions/32065160/method-floatmath-sqrt-not-found

3.HttpClient won’t import in Android Studio

HttpClient is not supported any more in sdk 23. You have to use URLConnection or downgrade to sdk 22 (compile 'com.android.support:appcompat-v7:22.2.0')

If you need sdk 23, add this to your gradle:

android {
    useLibrary 'org.apache.http.legacy'
}
You also may try to download and include HttpClient jar directly into your project or use OkHttp instead

http://stackoverflow.com/questions/32153318/httpclient-wont-import-in-android-studio

猜你喜欢

转载自blog.csdn.net/u011570979/article/details/50523166