Udgivet i Skriv en kommentar

Cordova – Android Remove unnecessary permissions

You have to open plugins/android.json, locate in that file part which looks like this.

"AndroidManifest.xml": {
 "parents": {
 "/*": [
 {
 "xml": "<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />",
 "count": 2
 },
 {
 "xml": "<uses-permission android:name=\"android.permission.RECORD_AUDIO\" />",
 "count": 1
 },
 {
 "xml": "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\" />",
 "count": 1
 },
 {
 "xml": "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\" />",
 "count": 1
 }
 ],
 "/manifest": [
 {
 "xml": "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\" />",
 "count": 1
 },
 {
 "xml": "<uses-permission android:name=\"android.permission.INTERNET\" />",
 "count": 1
 }
 ],

After removal of  lines, make sure that android.json still be valid JSON file. Also please notice the count property which indicates how many plugins use the permissions. If you have value more then 1 you should find which other plugins could use that permission. Also I don’t sure that Cordova plugins was tested to be workable without proper permissions, so you on your own when removing permissions from that file.
If you put your system in the broken state, you always could remove all content of platforms and plugins folders and recreate your project by running.
Remember to remove permissions in AndroidManifest.xml to.

cordova create...
cordova platform add ...
cordova plugin add ...

Source:

Udgivet i Skriv en kommentar

Set the PATH in Win 7 to NPM, GIT, Cordova and Android

ANDROID_HOME
C:\somewhere

JAVA_HOME
C:\somewhere

ANDROID_HOME
C:\somewhere

ANT_HOME
C:\somewhere

PATH
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%ANDROID_HOME%\tools\;%ANDROID_HOME%\platform-tools\;%JAVA_HOME%\bin\;%ANT_HOME%\bin\;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Users\User\AppData\Roaming\npm