1. 程式人生 > >android SDK23 一些api無法使用的解決方案

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(); 

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

(float)Math.sqrt(...)

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