Testing Navigation Drawer with Material Design App. When I run the app in Android Studio, I got the following error. App is installed in my phone but could launch. Please let me know what permission I am missing to add.
Launching application: com.jobsclipper.jobs/com.jobsclipper.jobs.MainActivity.
DEVICE SHELL COMMAND: am start -n
"com.jobsclipper.jobs/com.jobsclipper.jobs.MainActivity" -a
android.intent.action.MAIN -c android.intent.category.LAUNCHER open:
Permission denied open: Permission denied Starting: Intent {
act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]
cmp=com.jobsclipper.jobs/.MainActivity }
Here is My manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jobsclipper.jobs"
android:versionCode="1"
android:versionName="1.0" >
<!-- for most things, including card.io & paypal -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Related
I created a sample Android TV app for testing purposes. I followed the documentation at
https://developer.android.com/training/tv/start/start
This is how my manifest file looks like:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.CourseViewer">
<activity
android:name=".MainActivity"
android:banner="#drawable/app_icon_your_company"
android:exported="true"
android:icon="#drawable/app_icon_your_company"
android:label="#string/title_activity_main"
android:logo="#drawable/app_icon_your_company"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".DetailsActivity"
android:exported="false" />
<activity
android:name=".PlaybackActivity"
android:exported="false" />
<activity
android:name=".BrowseErrorActivity"
android:exported="false" />
</application>
</manifest>
This is what I get when I run the app on an android tv emulator. Can someone please let me know what is missing in the manifest file? I do have the MainActivity and the manifest looks fine to me.
02/20 11:38:56: Launching 'app' on Android TV (4K) API 33.
Install successfully finished in 824 ms.
$ adb shell am start -n "edu.app.courseviewer/edu.app.courseviewer.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "edu.app.courseviewer/edu.app.courseviewer.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=edu.app.courseviewer/.MainActivity }
Error type 3
Error: Activity class {edu.app.courseviewer/edu.app.courseviewer.MainActivity} does not exist.
Error while Launching activity
Failed to launch an application on all devices
I have tried restarting android studio, invalidating caches and restart, synced gradle files. I was hoping the app would start on Android TV emulator.
I am trying to launch an activity using adb. If I remove the custom permission tag android:permission from below snippet from manifest (manifest stripped for brevity), then everything is working fine.
<manifest ... package="com.example.pkgname">
<permission android:name="com.example.pkgname.BIND"
android:protectionLevel="normal"/>
.
.
.
<uses-permission android:name="com.example.pkgname.BIND" />
<application android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:name="com.example.pkgname.ManagerApplication"
android:supportsRtl="true" android:theme="#style/Theme.Security.Main">
<activity
android:exported="true"
android:launchMode="singleTask"
android:name="com.example.activity1"
android:permission="com.example.pkgname.BIND" />
</application>
</manifest>
I tried this : adb shell am start -n com.example.pkgname/com.example.activity1
which threw below error :
Security exception: Permission Denial: starting Intent { flg=0x10000000 cmp=com.example.pkgname/com.example.activity1 } from null (pid=16893, uid=3000) requires com.example.pkgname.BIND
How do I launch activity with custom permissions through adb?
I was recently creating an app that uses bluetooth. The problem is my app crashes when ever I start the bluetooth service. Here's my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="in.petalappstudio.fit" >
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH"/>
<uses-permission android:name="ANDROID.PERMISSION.BLUETOOTH_ADMIN"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name=".bluetoothManager"
android:enabled="true"
android:exported="true">
</service>
</application>
Now as you can see I have added permission for bluetooth and bluetooth admin.
How ever my app crashes and in LOGCAT the error is
"java.lang.RuntimeException: Unable to start service " and is caused by
"java.lang.SecurityException: Need BLUETOOTH ADMIN permission: Neither user 10145 nor current process has android.permission.BLUETOOTH_ADMIN."
But I have added permission as you can see. Now why is this happening ?
Try to add one more permission :
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Refe. : Android Permission BLUETOOTH Manifest error
Note : also check device support Bluetooth feature or not using :
<uses-feature android:name="android.hardware.bluetooth" android:required="true" />
I'm an android newbie. I'm using the android studio and connecting to a device, 4.04, api 14. I created a default login activity. It throws up the following exception:
Launching application: com.noatta.www.noatta_14/com.noatta.www.noatta_14.LoginActivity.
DEVICE SHELL COMMAND: am start -n "com.noatta.www.noatta_14/com.noatta.www.noatta_14.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.noatta.www.noatta_14/.LoginActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.noatta.www.noatta_14/.LoginActivity } from null (pid=16079, uid=2000) not exported from uid 10127
at android.os.Parcel.readException(Parcel.java:1332)
at android.os.Parcel.readException(Parcel.java:1286)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1691)
at com.android.commands.am.Am.runStart(Am.java:451)
at com.android.commands.am.Am.run(Am.java:107)
at com.android.commands.am.Am.main(Am.java:80)
at com.android.internal.os.RuntimeInit.finishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:260)
at dalvik.system.NativeStart.main(Native Method)
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.noatta.www.noatta_14" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
<!-- To access Google+ APIs: -->
<uses-permission android:name="android.permission.INTERNET" />
<!--
To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
option is required to comply with the Google+ Sign-In developer policies
-->
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<!-- To retrieve the account name (email) as part of sign-in: -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
</manifest>
Anybody have a suggestion on how to prevent the read exception?
You're missing <intent-filter> in activity definition:
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
You are missing the intent-filter and the exception states you were missing the android:exported="true" in your AndroidManifest.xml
<activity
android:name=".LoginActivity"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize|stateHidden"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I am a newbie to Android application development... When i try to run my application i am getting a security exception as Permission Denial... though i am able to open my application i am unable to proceed to any of the process... Application doesn't access the web service... Plz help me out...
The following is the exception message I receive,
[2012-01-11 11:02:09 - eCalc] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.anb.eCalculator/.LoginActivity } from null (pid=-1, uid=-1) requires android.permission.INTERNET
enter code here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.anb.eCalculator"
android:installLocation="internalOnly"
android:versionName="1.2.1" android:versionCode="10">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application android:label="#string/app_name"
android:theme="#android:style/Theme"
android:permission="android.permission.INTERNET"
android:icon="#drawable/ecalcicon" android:allowClearUserData="true">
<activity android:name=".LoginActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".CalculationActivity"></activity>
<activity android:name="ResultActivity"></activity>
<activity android:name=".InformationActivity"></activity>
<activity android:name=".RegisterActivity"></activity>
<activity android:name=".SettingsActivity"></activity>
<activity android:name=".ResultDetailsActivity"></activity>
<activity android:name=".Disclaimer"></activity>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:targetSdkVersion="5"
android:minSdkVersion="5"
android:maxSdkVersion="12">
</uses-sdk>
<uses-permission android:name="android.permission.INTERNET" />
Add this above line in your manifest file after your <uses-sdk> line.
Add this permission to your manifest file.
<uses-permission android:name="android.permission.INTERNET" />
I fixed it .
Click on "Run" and "Edit configuration". Select the activity you want to launch.