Skip to content

Commit

Permalink
android: fix ndk download link, and use unzip from system directly (z…
Browse files Browse the repository at this point in the history
…ipfile from python have issue with permission, it doesn't give executable bit to executable.)
  • Loading branch information
tito committed Feb 6, 2017
1 parent 3e931fc commit 81b1a49
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ pip-log.txt
#Mr Developer
.mr.developer.cfg
MANIFEST

release\.log\.utf-8\.tmp
5 changes: 1 addition & 4 deletions buildozer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,7 @@ def file_extract(self, archive, cwd=None):
return

if archive.endswith('.zip'):
archive = join(cwd, archive)
zf = zipfile.ZipFile(archive)
zf.extractall(path=cwd)
zf.close()
self.cmd('unzip {}'.format(join(cwd, archive)), cwd=cwd)
return

raise Exception('Unhandled extraction for type {0}'.format(archive))
Expand Down
14 changes: 11 additions & 3 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _install_android_ndk(self):

elif platform.startswith('linux'):
if int(_version) > 9: # if greater than 9, take it as .bin file
archive = 'android-ndk-r{0}-linux-{1}.bin'
archive = 'android-ndk-r{0}-linux-{1}.zip'
else:
archive = 'android-ndk-r{0}-linux-{1}.tar.bz2'
is_64 = (os.uname()[4] == 'x86_64')
Expand All @@ -303,7 +303,7 @@ def _install_android_ndk(self):
unpacked = 'android-ndk-r{0}'
archive = archive.format(self.android_ndk_version, architecture)
unpacked = unpacked.format(self.android_ndk_version)
url = 'http://dl.google.com/android/ndk/'
url = 'http://dl.google.com/android/repository/'
self.buildozer.download(url,
archive,
cwd=self.buildozer.global_platform_dir)
Expand Down Expand Up @@ -755,6 +755,14 @@ def build_package(self):

self.execute_build_package(build_cmd)

try:
self.buildozer.hook("android_pre_build_apk")
self.execute_build_package(build_cmd)
self.buildozer.hook("android_post_build_apk")
except:
# maybe the hook fail because the apk is not
pass

# XXX found how the apk name is really built from the title
bl = u'\'" ,'
apptitle = config.get('app', 'title')
Expand Down Expand Up @@ -814,7 +822,7 @@ def _update_libraries_references(self, dist_dir):
with io.open(project_fn, 'w', encoding='utf-8') as fd:
fd.writelines(content)
for index, ref in enumerate(references):
fd.write(u'\nandroid.library.reference.{}={}'.format(index + 1,
fd.write(u'android.library.reference.{}={}\n'.format(index + 1,
ref))

self.buildozer.debug('project.properties updated')
Expand Down

2 comments on commit 81b1a49

@pbrach
Copy link

@pbrach pbrach commented on 81b1a49 Feb 12, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange: for me the old address with 'ndk' still works and the new one (with 'repository') can not be found.

And I am not the only one:
http://stackoverflow.com/questions/42097586/buildozer-android-ndk-not-downloading-ubuntu/42191418#42191418

@Zen-CODE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pbrach. Just pushed some changes to the ndk path. Please try now?

Please sign in to comment.