I've got this strange error when building my project in Android Studio. Basically my app uses GPS to get the current location of the user.So in my androidmanifest.xml i've placed this line:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
But when building the app,this exception keeps popping up:
E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.SecurityException: Provider gps requires ACCESS_FINE_LOCATION permission
When using the networkprovider for the lastKnownLocation, the app works fine (and will most likely use another permission).
EDIT: the permissions tag is not within the Application tag.
Does anyone recognize this error?
Place it outside application tag.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<application.....
Make sure the uses-permission element is not inside the application element. Android Studio will not show any problem in this case.
OK, I've now rebuild the entire manifestfile and the error is gone. But essentially this is just a 1:1 copy of the old manifest file. So it's still a mystery what caused the error in the first place.
Thanks for all the help and advice!
Related
I am following this 2 tutorial. Tutorial 1 and Tutorial 2. But When i run thid project in my Moto G phone its unfortunately stop means after 17 api this is not working & give error
Caused by: java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE from pid=8675, uid=10233
I set permission in manifest file.
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<protected-broadcast android:name="android.intent.action.AIRPLANE_MODE" />
I am also checking some solution like Permission Link. I am getting still this error. So, how can i resolve it?
Thanks in advance.
This broadcast can (now) only be sent by a system app, not by an installed app.
So unless you can get Motorola to sign your app as a system app, you are out of luck.
I had already added this permission in my Manifest
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
But it will not give me permission to cut the incoming call, I can receive the call.when I'm try to cut the call it give me
java.lang.SecurityException: Neither user 10037 nor current process has android.permission.MODIFY_PHONE_STATE.
I have gone through so many blogs,but none of work.
In some of the emulator its working fine.
MODIFY_PHONE_STATE is a system-only permission, so you can not access or use this permission in your app,
Check it out!
Place your app in the /system/priv-app folder instead of /system/app, when using Android 4.3 or higher.
After running I am able to see the app, but when I restart the emulator and click the app, its just showing App isn't installed. what could be the reason?
check your android AndroidManifest.xml file carefully, there may be something wrong like you have given the wrong permission or added one permission twice. If not then add this user permission to your file
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Also check if you have specified the launcher correctly in menifest file
On a tablet I installed a apk develloped in Eclipse under Ubuntu. The App works on the AVD and is already installed on a phone and working.
The installation of the apk gives no error, however when starting the App it gives a "not installed" toast message.
In the aLogCat output I see a Permission denial message of the Launcher for WRITE_EXTERNAL_STORAGE. Note that the USB connection is not connected when I started the App.
Furthermore I noticed the following line in aLogCat and I noted that the "-1" was added to the package name.
New package installed in /data/app/com.company.AppName-1.apk
In the manifest the lines
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
are in the manifest block and
<android:permission="android.permission.WRITE_EXTERNAL_STORAGE">
in the application block.
Why is this working on a Android 2.3 phone and in a Android 4.0.3 AVD, but not on a Android 4.0.3 tablet?
Platform info: Eclipse 3.7.2, Tablet: Yarvik TAB461EUK; Installed with "ES File Explorer"
Try removing the permission from the application block. I dont know for sure but from personal experience ICS do not support permission attribute in application block which has already been defined in the main block. It inherits from the main block. Please tell if that solves the problem.
I dont know why it works on the AVD, may be because AVD do not have any external storage.
Related documentation:
http://developer.android.com/guide/topics/manifest/manifest-intro.html describes the permission element only for the main manifest block (now)
Changes per version states:
HONEYCOMB: When an application requires a permission to access one of its components (activity, receiver, service, provider), this permission is no longer enforced when the application wants to access its own component. This means it can require a permission on a component that it does not itself hold and still access that component.
Activity states:
The name of a permission that clients must have to launch the activity or otherwise get it to respond to an intent. If a caller of startActivity() or startActivityForResult() has not been granted the specified permission, its intent will not be delivered to the activity.
If this attribute is not set, the permission set by the element's permission attribute applies to the activity. If neither attribute is set, the activity is not protected by a permission.
Not very clear to me
I am accessing the JSON webServices but it is not running and it is showing execption.
I made a activity and calling the services from this activity class, when i run from java code services running fine but not running in android....what could be the reason behind this?
I am following standard code of calling from another project, also the services running in that project but not on mine. thanks.
Add permissions to access internet before calling services,
add following lines to your menifest files.
<uses-permission android:name="android.permission.INTERNET">
</uses-permission>
check and tell if still there any problem