Process: com.example.network, PID: 13470 java.lang.SecurityException: Invalid value for visibility: 2 at android.os.Parcel.createException(Parcel.java:1953) at android.os.Parcel.readException(Parcel.java:1921) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135) at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476) at android.content.ContentResolver.insert(ContentResolver.java:1611) at android.app.DownloadManager.enqueue(DownloadManager.java:1023) at com.example.network.activity.DownloadImageActivity$ImageUrlSelectedListener.onItemSelected(DownloadImageActivity.java:103) at android.widget.AdapterView.fireOnSelected(AdapterView.java:947) at android.widget.AdapterView.dispatchOnItemSelected(AdapterView.java:936) at android.widget.AdapterView.access$300(AdapterView.java:56) at android.widget.AdapterView$SelectionNotifier.run(AdapterView.java:901) at android.os.Handler.handleCallback(Handler.java:891) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:7470) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:958)
原因出在设置下载图片,下载图片时不提示通知栏,应该在AndroidManifest.xml中添加相应的权限
<!-- 下载时不提示通知栏 --> <uses-permission android:name="android.permission.DOWNLOAD_WITHOUT_NOTIFICATION" />