Phonegap generates a lot of permissions when it creates the apk file.
How can I open and edit my apk file to remove the permissions?
How can I open and edit my apk file to remove the permissions?
- 17 Posts
- 0 Reply Likes
Posted 6 years ago
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
If you add the following to your config.xml your apk won't require all those permissions.
Any plugins you use will cause additional permissions to be added based on what the plugin can do. However, sometimes you might include a plugin but not use all of its features. For example, if you add the Media plugin but only use it for playing sounds it will add permissions for using video and accessing your SD card that you don't need. In this case, you may want to edit the .apk file like you asked. There is a tool called apktool that will help you. I use the following commands to remove some permissions and then rebuild the .apk file.
edit the manifest xml file and then package it back up using
<preference name="permissions" value="none"/>
Any plugins you use will cause additional permissions to be added based on what the plugin can do. However, sometimes you might include a plugin but not use all of its features. For example, if you add the Media plugin but only use it for playing sounds it will add permissions for using video and accessing your SD card that you don't need. In this case, you may want to edit the .apk file like you asked. There is a tool called apktool that will help you. I use the following commands to remove some permissions and then rebuild the .apk file.
java -jar apktool.jar decode -f MyApp-release.apk
edit the manifest xml file and then package it back up using
java -jar apktool.jar build MyApp-release MyApp-release.apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore c:\users\john\my.keystore MyApp-release.apk johnweidner
c:\utils\sdk\build-tools9.1.0\zipalign -f -v 4 MyApp-release.apk MyApp-release2.apk- 8261 Posts
- 263 Reply Likes
Hi Oscar
Did the above answer by John provide any good helps? Let us know.
Thanks
Did the above answer by John provide any good helps? Let us know.
Thanks
- 17 Posts
- 0 Reply Likes
Hey,
It was the answer I was looking for but I was still not able to solve my problem.
Have you at Phonegap considered of making permissions alternatives in the settings menu?
It was the answer I was looking for but I was still not able to solve my problem.
Have you at Phonegap considered of making permissions alternatives in the settings menu?
- 8261 Posts
- 263 Reply Likes
Hi Oscar
That should be a great area to improvise. Hence, appreciate if you can create feature request at the following issue tracker:
https://github.com/phonegap/build/issues
Cheers!
That should be a great area to improvise. Hence, appreciate if you can create feature request at the following issue tracker:
https://github.com/phonegap/build/issues
Cheers!
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
I just added one. https://github.com/phonegap/build/iss...
John Weidner, Champion
- 435 Posts
- 80 Reply Likes
You can now remove permissions without doing all this. You can just add some code to your config.xml. http://community.phonegap.com/nitobi/...
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers



Oscar
John Weidner, Champion
Oscar
John Weidner, Champion
1. use the apktool to extract the manifest file,
2. edit the manifest file and delete the lines you don't want
3. repackage the apk file with apktool
4. resign the file with jarsigner
5. zipalign the file
I'm sure someone couple write a script to put all of this together. Maybe someday Phone Gap Build will have an option that let's you use a plugin without having to inherit all of the plugins required permissions.
Oscar
Now I need to convert it back to apk again.Any ideas how to do this?
John Weidner, Champion
Oscar
apkpure
More tool here : apktool