버튼을 클릭하면 PDF 파일을 열 수있는 응용 프로그램이 있습니다. 그것은 안드로이드의 모든 버전에 functionnal했지만 그것은 안드로이드 7.1.1에 충돌 왜 모르겠어 :이 내가Android 7.1.1의 ActivityNotFoundException
ActivityNotFoundException when starting
No Activity found to handle Intent splash screen
살펴 보았다 관련 질문이/
내 기능은 MainActivity에서 파일을 엽니 다 :
private void readPDF({
File f = new File(getFilesDir(), "toto.pdf");
if (!f.exists()) {
AssetManager assets=getResources().getAssets();
try {
copy(assets.open("toto.pdf"), f);
}
catch (IOException e) {
Log.e("FileProvider", "Exception copying from assets", e);
}
}
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = getUriForFile(this, getApplicationContext().getPackageName() + ".fileprovider", f);
intent.setDataAndType(uri, "application/pdf");
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
revokeUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);
}
private void copy(InputStream in, File dst) throws IOException {
FileOutputStream out=new FileOutputStream(dst);
byte[] buf=new byte[1024];
int len;
while ((len=in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
}
내 매니페스트 :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.fr">
<application
android:allowBackup="true"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.fr.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
<activity
android:name="com.example.fr.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
마지막 오류 코드 :
04-26 08 : 15 : 16.991 21748-21748/com.example.fr E/AndroidRuntime : 치명적인 예외 : 주요 프로세스 : com.example.fr, PID : 21748 android.content.ActivityNotFoundException : Intent {act = android.intent.action.VIEW dat = content : //com.example.fr.fileprovider/assets/toto를 처리 할 활동이 없습니다. pdf typ = application/pdf flg = 0x1} android.app의 android.app.Activity.startActivityForResult (Activity.java:4225) 에서 android.app.Instrumentation.execStartActivity (Instrumentation.java:1523) 에서 .Instrumentation.checkStartActivityResult (Instrumentation.java:1809) 에서 android.support.v4 android.app.Activity.startActivityForResult (Activity.java:4183)에서 android.support.v4.app.FragmentActivity.startActivityForResult (FragmentActivity.java:75) 에서 .app.BaseFragmentActivityJB.startActivityForResult (BaseFragmentActivityJB.java:48) (액티브 .java : 4522) android.app.Activity.startActivity (Activity.java:4490) at com.example.fr.MainActivity.readPDF (MainActivity.java:58) at com.example.fr.MainActivity.access $ 000 (MainActivity.java : 21) at com.example.fr.MainActivity $ 1.onClick (MainActivity.java:34) at android.view.View.performClick (View.java:5637) android.view.View $ PerformClick.run (View.java : 22429) android.os.Handler.handleCallback (Handler.java:751) at android.os.Handler.dispatchMessage (Handler.java:95) at android.os.Looper.loop (루퍼. java : 154) android.app.ActivityThread.main (ActivityThread.java:6119) at java.lang.reflect.Method.invoke (네이티브 메소드) at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java : 886) at com.android.internal.os.ZygoteInit.main (ZygoteInit.자바 : 776)
감사의 도움
어떤 응용 프로그램에서 PDF 파일을 처리 할 것으로 예상합니까? 해당 응용 프로그램이 설치되어 있지 않을 수 있습니다. –