Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[app] "android.permission" contain an unknown permission #6

Closed
bob-the-hamster opened this issue Feb 5, 2013 · 7 comments
Closed

Comments

@bob-the-hamster
Copy link
Contributor

When I run buildozer, I get the following error:

james@rhinoctopus:~/src/secrethamster/kivy/bobdirt$ buildozer android debug deploy
# Check configuration tokens
# Ensure build layout
# Check configuration tokens
# Check target configuration tokens
#1 error(s) found in the buildozer.spec
[app] "android.permission" contain an unknown permission 

My buildozer.spec does not modify the default for android.permissions:

# (list) Permissions
#android.permissions = INTERNET
@bob-the-hamster
Copy link
Contributor Author

Apparently the default value for android.permissions is [""] and that one null value is not found in the list of valid permissions. Here is a patch to fix it:

diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py
index 2a5c496..953449f 100644
--- a/buildozer/targets/android.py
+++ b/buildozer/targets/android.py
@@ -117,7 +117,7 @@ class TargetAndroid(Target):
             permissions = self.buildozer.config.getlist(
                 'app', 'android.permissions', [])
             for permission in permissions:
-                if permission not in available_permissions:
+                if permission and permission not in available_permissions:
                     errors.append(
                         '[app] "android.permission" contain an unknown'
                         ' permission {0}'.format(permission))

@bob-the-hamster
Copy link
Contributor Author

Actually, here is a better patch that also fixes the typo in the error message:

diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py
index 2a5c496..2ec7bae 100644
--- a/buildozer/targets/android.py
+++ b/buildozer/targets/android.py
@@ -117,9 +117,9 @@ class TargetAndroid(Target):
             permissions = self.buildozer.config.getlist(
                 'app', 'android.permissions', [])
             for permission in permissions:
-                if permission not in available_permissions:
+                if permission and permission not in available_permissions:
                     errors.append(
-                        '[app] "android.permission" contain an unknown'
+                        '[app] "android.permissions" contain an unknown'
                         ' permission {0}'.format(permission))

         super(TargetAndroid, self).check_configuration_tokens(errors)

@tshirtman
Copy link
Member

Can you do a pull request of that? :)
(there is an other grammar mistake in the error message by the way :P)

@bob-the-hamster
Copy link
Contributor Author

I have never done a pull request before, but I am happy to try.

I realized that buildozer still fails later on when android.permissions is left blank

build.py: error: argument --permission: expected one argument
# Command failed: /usr/bin/python2.7 build.py --name 'Bob the Hamster Dirt Dig' --version 0.1 --package com.hamsterrepublic.bobdirt --private /home/james/src/secrethamster/kivy/bobdirt/.buildozer/android/app --sdk 14 --minsdk 8 --permission  --presplash /home/james/src/secrethamster/kivy/bobdirt/.buildozer/android/app/./src/../distimg/presplash.jpg --icon /home/james/src/secrethamster/kivy/bobdirt/.buildozer/android/app/./src/../distimg/icon.png debug

I'll see if I can come up with a more correct patch.

@bob-the-hamster
Copy link
Contributor Author

I would like to learn to do a pull request, but It seems complicated, so for now, here is a better patch. This does not produce any --permission arguments for blank permissions

diff --git a/buildozer/targets/android.py b/buildozer/targets/android.py
index 2a5c496..3625788 100644
--- a/buildozer/targets/android.py
+++ b/buildozer/targets/android.py
@@ -116,10 +116,11 @@ class TargetAndroid(Target):
         if available_permissions:
             permissions = self.buildozer.config.getlist(
                 'app', 'android.permissions', [])
+            print permissions
             for permission in permissions:
-                if permission not in available_permissions:
+                if permission and permission not in available_permissions:
                     errors.append(
-                        '[app] "android.permission" contain an unknown'
+                        '[app] "android.permissions" contains an unknown'
                         ' permission {0}'.format(permission))

         super(TargetAndroid, self).check_configuration_tokens(errors)
@@ -372,7 +373,8 @@ class TargetAndroid(Target):
         permissions = config.getlist('app',
                 'android.permissions', [])
         for permission in permissions:
-            build_cmd += ' --permission {0}'.format(permission)
+            if permission:
+                build_cmd += ' --permission {0}'.format(permission)

         # add presplash
         presplash = config.getdefault('app', 'presplash.filename', '')

@bob-the-hamster
Copy link
Contributor Author

Okay. I sent a pull request for a proper fix for this.

@tito
Copy link
Member

tito commented Feb 7, 2013

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants