Android studio , is giving me some issues. I clearly declared android. permission.GET_TASKS in the manifest. But it still closes the app.
Error:
Caused by: java.lang.SecurityException: Permission Denial: getTasks() from pid=1010, uid=10046 requires android.permission.GET_TASKS
AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.epiclapser.noprocrastinate" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<uses-sdk
android:maxSdkVersion="18"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.GET_TASKS"/>
>
<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>
<activity
android:name=".MainActivity2"
android:label="#string/title_activity_main_activity2"></activity>
<activity
android:name=".LockScreen"
android:label="#string/title_activity_lock_screen"
>
</activity>
</application>
Move your permission Tag outside of Application Tag
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.GET_TASKS"/>
<application
android:icon="#drawable/ic_launcher"
<!--Elements inside application Tag-->
</application>
Related
My Android emulators not taking internet permission.
My Manifest File;
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.codework.myapplication">
<permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/app_name" />
</application>
</manifest>
LogCat Error;
AndroidManifest Error: WebView login requires INTERNET permission
In Settings - No permissions requested;
Replace
<permission android:name="android.permission.INTERNET" />
With
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INTERNET">
NOT
permission ...
My manifest gives me this error:
Element type "activity" must be followed by either attribute
specifications, ">" or "/>"
I have however opened and closed the activity tag as expected. I've also cleaned the project in an attempt to solve this problem but to no avail.
Here is my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
`enter code here` package="com.TeamX.shuttle_app"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="21" />
<uses-permission android:name = "com.TeamX.shuttle_App.permission.MAPS_RECEIVE"/>
<uses-permission android:maxSdkVersion="21" android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:maxSdkVersion="21" android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:maxSdkVersion="21" android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:maxSdkVersion="21" android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:allowBackup="true"
android:icon="#drawable/shuttapplogo"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyA7SnyyG2IZ4flWaZelTOWKcrFVnsrLCck" />
<activity
android:name="com.TeamX.shuttle_app.ShuttleSplash"
android:label="#string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.TeamX.shuttle_App.Main"
android:label="#string/app_name"
</activity>
</application>
</manifest>
your
<activity
android:name="com.TeamX.shuttle_App.Main"
android:label="#string/app_name"
</activity>
should be
<activity
android:name="com.TeamX.shuttle_App.Main"
android:label="#string/app_name" />
Instead of:
<activity
android:name="com.TeamX.shuttle_App.Main"
android:label="#string/app_name"
</activity>
Do this:
<activity
android:name="com.TeamX.shuttle_App.Main"
android:label="#string/app_name">
</activity>
I have been doing some NFC development on android, and I have hit a brick wall. I launch the app and it immediatly fails with a "Unfortunately,..... has stopped working".
Some quick googling showed I need the put the permission in the manifest. I did that, but lo and behold, I still get the same error!
Here is the start of my manifest:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-permission android:name="android.permission.NFC" />
<uses-sdk android:minSdkVersion="10"/>
<uses-feature android:name="android.hardware.nfc" android:required="true" />
<activity
android:name=".MainActivity"
<!-- rest of the file --->
And the output in logcat:
java.lang.RuntimeException: Unable to resume activity {za.co.fnb.ms.nfcreader/za.co.fnb.ms.nfcreader.MainActivity}: java.lang.SecurityException: NFC permission required: Neither user 10253 nor current process has android.permission.NFC.
What am I doing wrong here?
The section
<uses-permission android:name="android.permission.NFC" />
<uses-sdk android:minSdkVersion="10"/>
<uses-feature android:name="android.hardware.nfc" android:required="true" />
Needs to be outside of your application tag.
Like
<uses-permission android:name="android.permission.NFC" />
<uses-sdk android:minSdkVersion="10"/>
<uses-feature android:name="android.hardware.nfc" android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
...
Read Structure of the Manifest File
<uses-permission>, <uses-sdk>, and <uses-feature> go outside the <application> element:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.commonsware.android.jimmyb"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.NFC"/>
<uses-feature
android:name="android.hardware.nfc"
android:required="true"/>
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="15"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/title_activity_main"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:label="#string/app_name">
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<data android:mimeType="vnd.secret/agent.man"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
(from this sample project)
Add these to activities which you use nfc:
<activity
android:name="com.example.example.CLASSNAME"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<data android:mimeType="mime/type" />
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="#xml/nfc_type"/>
</activity>
And also you have to define permissions before application tag.
I tried searching stackoverflow.com and tried every answer but none of them work.
I have a content provider and it was working when the user of the content provider is in the same application. However, I have Permission Denial error when accessing from another application.
LogCat
Caused by: java.lang.SecurityException: Permission Denial: opening provider com.abc.contentprovidersbooks.BooksProvider from ProcessRecord{4174b338 18673:com.abc.contentprovidersuserbooks/u0a10112} (pid=18673, uid=10112) requires com.abc.contentprovidersbooks.READ_DATABASE or com.abc.contentprovidersbooks.WRITE_DATABASE
Content Provider AndroidManifest:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.abc.contentprovidersbooks"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="com.abc.contentprovidersbooks.ContentProvidersBook"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider android:name="BooksProvider"
android:authorities="com.abc.contentprovidersbooks.Books"
android:readPermission="com.abc.contentprovidersbooks.READ_DATABASE"
android:writePermission="com.abc.contentprovidersbooks.WRITE_DATABASE"
android:exported="true">
</provider>
</application>
Content Provider User application AndroidManifest:-
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tshouse.contentprovidersuserbooks"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17" />
<uses-permission android:name="com.tshouse.contentprovidersbooks.READ_DATABASE"/>
<uses-permission android:name="com.tshouse.contentprovidersbooks.WRITE_DATABASE"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:readPermission="com.tshouse.contentprovidersbooks.READ_DATABASE"
android:writePermission="com.tshouse.contentprovidersbooks.WRITE_DATABASE"
>
<activity
android:name="com.tshouse.contentprovidersbooks.ContentProvidersUserBooks"
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>
Please advise how to declare the permission.
Thanks
If I had to guess, you installed the consumer app before the provider app, which will not work as you have it written.
If you put the <permission> elements in both apps, then the install order will not matter.
Also, you cannot put android:readPermission and android:writePermission on <application>, as you have in your consumer manifest. Simply delete those.
I switched in manifest manually between activities because I made new activity that needed to be first. Everything works fine, but in the apps screen in my launcher where I see all apps below my app icon i see the name of the first activity "SplashScreen", but when I uninstall in or go to my apps I see that the name is OK.
My manifest:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE"/>
<application
android:hardwareAccelerated="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:largeHeap="true"
android:theme="#android:style/Theme.NoTitleBar" >
<activity
android:name="com.myapp.SplashScreen"
android:label="#string/title_activity_splash_screen"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.myapp.MainScreen"
android:label="#string/title_activity_main_screen"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.myapp.Cameras"
android:label="#string/title_activity_cameras"
android:screenOrientation="portrait" >
</activity>
</application>
android:label="#string/title_activity_splash_screen"
that is the name being used.
you can just delete this line (and all the label from the other activities) and let all activities use the application name #string/app_name
<activity
android:name="com.myapp.SplashScreen"
android:label="#string/app_name"
android:screenOrientation="portrait" >
This should display the Application name