When trying to run a local file on Android, the MIME type needs to be set as well for the Intent. Thus the QDesktopServices::openUrl((QUrl("file:///sdcard/temp/SCM.apk"))) gives the following error: I/ActivityManager( 2704): Starting: Intent { act=android.intent.action.VIEW dat=file:///sdcard/temp/SCM.apk } from pid 8656 E/AndroidRuntime( 8656): FATAL EXCEPTION: Thread-10 E/AndroidRuntime( 8656): java.lang.NoClassDefFoundError: org.kde.necessitas.industrius.QtNative$4 E/AndroidRuntime( 8656): at org.kde.necessitas.industrius.QtNative.setFullScreen(QtNative.java:400) E/AndroidRuntime( 8656): at dalvik.system.NativeStart.run(Native Method) E/AndroidRuntime( 8656): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=file:///sdcard/temp/SCM.apk} E/AndroidRuntime( 8656): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409) E/AndroidRuntime( 8656): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379) E/AndroidRuntime( 8656): at android.app.Activity.startActivityForResult(Activity.java:2833) E/AndroidRuntime( 8656): at android.app.Activity.startActivity(Activity.java:2959) E/AndroidRuntime( 8656): at org.kde.necessitas.industrius.QtNative.openURL(QtNative.java:76) E/AndroidRuntime( 8656): ... 1 more I think this may be fixed by changing the openURL function in src/android/jar/src/org/kde/necessitas/industrius/QtNative.java from public static void openURL(String url) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); activity().startActivity(intent); } to the following: public static void openURL(String url) { if (url.toLowerCase().startsWith("file:")) { Intent intent = new Intent(Intent.ACTION_VIEW); MimeTypeMap mime = MimeTypeMap.getSingleton(); File file = new File(url); String ext=file.getName().substring(file.getName().lastIndexOf(".")+1).toLowerCase(); String type = mime.getMimeTypeFromExtension(ext); intent.setDataAndType(Uri.fromFile(file),type); activity().startActivity(intent); } else { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); activity().startActivity(intent); } } Must also add the following import: import android.webkit.MimeTypeMap; Otherwise one will have to find a mechanism to provide the MIME filetype some other way. Reproducible: Always Steps to Reproduce: 1. Create Hello World Necessitas application. 2. In main.cpp add code QDesktopServices::openUrl((QUrl("file:///sdcard/temp/image.jpg"))) 3. Make sure there is temp/image.jpg file on sd card. 4. Run the program. Actual Results: No intent with image pops up. Expected Results: Gallery application intent with image pops up. This is a bug reported by TomasL on the sourceforge page of Necessitas http://sourceforge.net/p/necessitas/tickets/159/
Hello! Sorry to be the bearer of bad news, but this project has been unmaintained for many years and I will be closing this bug.