android - Try to start library project Activity -
i have library project , main project , try start activity defined in library project main project.
intent intent = new intent("isr.launch"); intent.setcomponent(new componentname("com.isr", "com.isr.activity.cameraactivity")); startactivity(intent);
but receive following exception:
05-14 17:13:42.853: e/androidruntime(29217): java.lang.securityexception: permission denial: starting intent { act=isr.launch cmp=com.isr/.activity.cameraactivity } processrecord{40aa7178 29217:com.ssbs.sw.swe/10094} (pid=29217, uid=10094) requires null 05-14 17:13:42.853: e/androidruntime(29217): @ android.os.parcel.readexception(parcel.java:1322) 05-14 17:13:42.853: e/androidruntime(29217): @ android.os.parcel.readexception(parcel.java:1276) 05-14 17:13:42.853: e/androidruntime(29217): @ android.app.activitymanagerproxy.startactivity(activitymanagernative.java:1351) 05-14 17:13:42.853: e/androidruntime(29217): @ android.app.instrumentation.execstartactivity(instrumentation.java:1374) 05-14 17:13:42.853: e/androidruntime(29217): @ android.app.activity.startactivityforresult(activity.java:2827) 05-14 17:13:42.853: e/androidruntime(29217): @ android.support.v4.app.fragmentactivity.startactivityforresult(fragmentactivity.java:817) 05-14 17:13:42.853: e/androidruntime(29217): @ android.app.activity.startactivity(activity.java:2933) 05-14 17:13:42.853: e/androidruntime(29217): @ com.ssbs.sw.ir.view.mainactivity$1$1.onmenuitemclick(mainactivity.java:58) 05-14 17:13:42.853: e/androidruntime(29217): @ com.ssbs.sw.swe.actionbarv5.menu.menubuttonhelper$1.onclick(menubuttonhelper.java:108) 05-14 17:13:42.853: e/androidruntime(29217): @ android.view.view.performclick(view.java:2492) 05-14 17:13:42.853: e/androidruntime(29217): @ android.view.view$performclick.run(view.java:9087) 05-14 17:13:42.853: e/androidruntime(29217): @ android.os.handler.handlecallback(handler.java:587) 05-14 17:13:42.853: e/androidruntime(29217): @ android.os.handler.dispatchmessage(handler.java:92) 05-14 17:13:42.853: e/androidruntime(29217): @ android.os.looper.loop(looper.java:130) 05-14 17:13:42.853: e/androidruntime(29217): @ android.app.activitythread.main(activitythread.java:3740) 05-14 17:13:42.853: e/androidruntime(29217): @ java.lang.reflect.method.invokenative(native method) 05-14 17:13:42.853: e/androidruntime(29217): @ java.lang.reflect.method.invoke(method.java:507) 05-14 17:13:42.853: e/androidruntime(29217): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:880) 05-14 17:13:42.853: e/androidruntime(29217): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:638) 05-14 17:13:42.853: e/androidruntime(29217): @ dalvik.system.nativestart.main(native method)
this manifest library project:
<uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.camera" /> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <uses-sdk android:minsdkversion="8" android:targetsdkversion="16" /> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" > <activity android:name=".activity.cameraactivity" android:exported="true" > <intent-filter> <action android:name="isr.launch" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity> </application>
how can fix this?
edit
main project manifest permissions:
<uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.access_wifi_state" /> <uses-permission android:name="android.permission.change_wifi_state" /> <uses-permission android:name="android.permission.read_phone_state" /> <uses-permission android:name="android.permission.vibrate" /> <uses-permission android:name="android.permission.get_tasks" /> <uses-permission android:name="android.permission.camera" /> <uses-permission android:name="android.permission.access_fine_location" /> <uses-permission android:name="android.permission.bluetooth" /> <uses-permission android:name="com.android.launcher.permission.install_shortcut" /> <uses-sdk android:minsdkversion="8" android:targetsdkversion="15" />
edit 2
have resolved problem coping main application manifest definition of called activity (but know if can without adding definition):
<activity android:name="com.isr.activity.cameraactivity"> <intent-filter> <action android:name="isr.launch" /> <category android:name="android.intent.category.default" /> </intent-filter> </activity>
and can start activity following code:
intent intent = new intent("isr.launch"); startactivity(intent);
the manifest main app must contain activity definitions wishes use. not required in library project not called there.
any activity definitions have in library manifest nothing @ all.
update: can merge manifest files other answers have mentioned.
Comments
Post a Comment