0
我試圖實現共享選項到我的應用程序,並通過不同的社交網絡共享圖像,但我收到這個錯誤,當我試圖保存圖像首先從ImageView的,然後閱讀:無法插入圖像需要android.permission.WRITE_EXTERNAL_STORAGE或grantUriPermission()
Failed to insert image java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri
content://media/external/images/media from pid=9758, uid=10176 requires android.permission.WRITE_EXTERNAL_STORAGE, or grantUriPermission()
這是我的清單文件:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".app.AppController"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
和gradle這個文件:
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.dusandimitrijevic.pdssolution"
minSdkVersion 15
targetSdkVersion 23
versionCode 3
versionName "1.2"
// Enabling multi dex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
https://stackoverflow.com/questions/32635704/android-permission-doesnt-work-even-if-i-have-declared-it – CommonsWare