跳到主要內容

發表文章

目前顯示的是 2020的文章

Error : android.os.FileUriExposedException

android.os.FileUriExposedException RootCause:從Android 7.0開始,一個應用提供自身檔案給其它應用使用時,如果給出一個file://格式的URI的話,應用會丟擲FileUriExposedException。這是由於谷歌認為目標app可能不具有檔案許可權,會造成潛在的問題。 Solution: 使用FileProvider code java Uri uri=FileProvider. getUriForFile (context , context . getApplicationContext (). getPackageName () , imgFile) ; // Uri uri = Uri.fromFile(imgFile); or FileProvider. getUriForFile (context , context . getApplicationContext (). getPackageName () , mCsvFile ) android mainfest <provider android :name ="android.support.v4.content.FileProvider" android :authorities ="PackageName.fileprovider" android :exported ="false" android :grantUriPermissions ="true" > <meta-data android :name ="android.support.FILE_PROVIDER_PATHS" android :resource ="@xml/file_paths" /> </provider> add xml file  file name   file_paths

error : java.lang.RuntimeException: Stub!

原因: 在android 9.0 ,Apache HTTP client, 已经从bootClassLoader 里面移除了。 我们可以看下android 官网自己说的: 2020-05-19 14:17:44.434 31933-32402/com.taidoc.tdlink.cs E/UploadRecordService: upload fail     java.lang.RuntimeException: Stub!         at org.apache.http.params.AbstractHttpParams.<init>(AbstractHttpParams.java:6)         at org.apache.http.params.BasicHttpParams.<init>(BasicHttpParams.java:7) <uses-library android:name="org.apache.http.legacy" android:required="false"/>

Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation

Caused by: java.lang.IllegalStateException: Only fullscreen opaque activities can request orientation 如題 在其他裝置都不會出現,目前出現在samsung S8 amdroid 8上出現 在 AndroidManifest 裡有使用到 android :theme ="@style/Theme.FullScreenDialog"某個style  到該style裡修改 <item name ="android:windowIsTranslucent" > false </item> <item name ="android:windowDisablePreview" > true </item>---->add

android eclipse transformation to android studio Error AAPT: error: style attribute 'attr/@attr/colorChecked (aka com.xxxxx:attr/@attr/colorChecked)' not found.

AAPT: error: style attribute 'attr/@attr/colorChecked 刪除 " @attr/" 即可!!

android studio build Error Duplicate resources

build Error Duplicate resources  drawable 目錄圖片和xml名字一樣,修改 就可以了 刪除 .9.png 即可